文档说明:只记录关键地方;
ceph 初始化
#!/bin/env bash
set -eux
__DIR__=$(cd "$(dirname "$0")";pwd)
cd ${__DIR__}
if [ ! "$BASH_VERSION" ] ; then
echo "Please do not use sh to run this script ($0), just execute it directly" 1>&2
exit 1
fi
test -f cephadm && rm cephadm
#默认不走代理,要走代理 脚本需要传递2个参数
PROXY_URL=${2:+'http://127.0.0.1:8010'}
export http_proxy=$PROXY_URL
export https_proxy=$PROXY_URL
test -f cephadm || curl -LO https://raw.githubusercontent.com/ceph/ceph/main/src/cephadm/cephadm
unset http_proxy
unset https_proxy
stat ./cephadm
chmod a+x ./cephadm
# enp0s3 网卡名称
ip=$(ip -4 address show | grep enp0s3 | grep 'inet' | awk '{print $2}' | awk -F '/' '{print $1}' | sed -n '1p')
# 使用配置文件初始化
# ./cephadm bootstrap --config initial-ceph.conf
# 不使用配置文件初始化
./cephadm bootstrap --single-host-defaults \
--mon-ip $ip --allow-overwrite \
--initial-dashboard-user admin \
--initial-dashboard-password dwz1y87b6o --dashboard-password-noupdate
删除容器版ceph
#!/bin/env bash
set -eux
__DIR__=$(cd "$(dirname "$0")";pwd)
cd ${__DIR__}
if [ ! "$BASH_VERSION" ] ; then
echo "Please do not use sh to run this script ($0), just execute it directly" 1>&2
exit 1
fi
./cephadm rm-cluster --fsid `awk -F "=" '/fsid/ {print $2}' /etc/ceph/ceph.conf` --force