ceph
REQUIREMENTS
Python 3
Systemd
Podman or Docker for running containers
Time synchronization (such as chrony or NTP)
LVM2 for provisioning storage devices
yum install lvm2 python3
安装
https://docs.ceph.com/en/latest/cephadm/#cephadm
Cephadm is new in the Octopus v15.2.0 release and does not support older versions of Ceph.
https://raw.githubusercontent.com/ceph/ceph/octopus/src/cephadm/cephadm <--> http://dld.as4k.top/cephadm
https://docs.ceph.com/en/latest/cephadm/install/
./cephadm add-repo --release octopus
./cephadm install
机器主机名需要标准,不能是数字开头
cephadm bootstrap --mon-ip 192.168.31.100
cephadm bootstrap --mon-ip 192.168.31.100 --config /etc/ceph/ceph.conf
[root@xpc100 ~]# cephadm rm-cluster --fsid fe9d6a80-8d0d-11eb-8e77-080027c37478 --force
ceph orch host add xpc102
登录信息
Mgr epoch 13 is available
Generating a dashboard self-signed certificate...
Creating initial admin user...
Fetching dashboard port number...
Ceph Dashboard is now available at:
URL: https://xpc101:8443/
User: admin
Password: l2jhapvrbk
Password: kyle123456
You can access the Ceph CLI with:
sudo /usr/sbin/cephadm shell --fsid 91cf105e-8e23-11eb-836c-080027e5ab23 -c /etc/ceph/ceph.conf -k /etc/ceph/ceph.client.admin.keyring
Please consider enabling telemetry to help improve Ceph:
ceph telemetry on
For more information see:
https://docs.ceph.com/docs/master/mgr/telemetry/
Bootstrap complete.
hosts 添加
192.168.31.100 xpc100
192.168.31.101 xpc101
192.168.31.102 xpc102
草稿
ssh-keygen -t rsa -P "" -f ~/.ssh/id_rsa; cat ~/.ssh/id_rsa.pub
cat << 'EOF' >> ~/.ssh/authorized_keys
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDUC8FAAmnmzfchF0LAOUGGCl8b3e+x+POizC4AdcQsUBpGoudWQkwk02sdS4gYwAoFXOnvHfqGfwi/+Ex9RC1O7Eq39vrEw96QE3npg20WGVqCXMGN2laNUP7gxPbiDV/oPG+Oi+nSt2qyXj2OfJS63vha53l5qm8X7rFcJpK7y6cJUvDitzYddDaOXg3yWvJ4w7CG+Fb/KBTVmF1SJsbT6OkOpHfKkgCuKAUOPLSa2ao//idTayItclBzn3cJyk4IN8On186DgIHh3gP/qswL9JC5CoYVG1OHrynIHTWTpoeDRjN/PYK0b72YLfibhNP6KVV1hmJjgUn1l6G8CYYf root@xpc100
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCfkxeFqARXHZ/oYcdwO0L5S1n0UiDxX1c8DwHCk6xDDXG47dEpQRZBHj7wxw+wAds+WWkDYgbpWcA1P+ngf6dsdy1ZF30Dphw6aMEj/JErUIbk4kHsdMznA2fAhH71mGFv0mvK7Ycl3YzzpCm2VoQ7zqQ97Bbz/rdqP8Y/bRDTTwVgqv/VR4g648Mn+nFYInmsABgufyWqCeXJGlaEVftaEXV3Cw+Tz1XcGSDM03fefSwJF5jqQD0BUrRPFLMtCVgpsGPIl5tGxQFivil62ux8+pQ8Uls5snpPAJtBVOHpmCZY+8WRx7wUGpucl/RutLG4F8RASiRPg4OUJ+2+AosZ root@xpc101
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCYCVbuA54nW58+lEiWLUk/jw3jlkwLEg6F2rVG4Hb7SvJkoCloHOQbclpygbQWTt7NrK5aGeRVrTC0K9gqb3kbdAvMKcBXArTbPX3jiZCJBoX8HXFZHRtDWwnzHszPyJFO1c2CtpEEJVgeG1AuJjNot2burda0PZkxL5pyOTuPSeTY1cmImLVITvDGEPj2QRLFfRXLVVXFFuSQzvVrbbNMxS/iEqxt8p4ZwRBE8fTsmXRcFRyoKDqweJSIslEUj1KJ3qZrV4nYrDHn+wEWXE3Zo20/OoiMzEF14dHDoQApm8VkVJgsaPdOglUF3QwHSyElFXgWdhYxaz/sTQtIWDez root@xpc102
EOF
chmod 0600 ~/.ssh/authorized_keys
sed -i '/node/d' /etc/hosts
echo '192.168.1.1 node1' >> /etc/hosts
echo '192.168.1.2 node2' >> /etc/hosts
echo '192.168.1.3 node3' >> /etc/hosts
cat /etc/hosts
ssh -o StrictHostKeyChecking=no -o ConnectTimeout=3 192.168.31.100 echo hello1
ssh -o StrictHostKeyChecking=no -o ConnectTimeout=3 192.168.31.101 echo hello2
ssh -o StrictHostKeyChecking=no -o ConnectTimeout=3 192.168.31.102 echo hello3
ceph repo
[root@xpc101 /etc/yum.repos.d]# cat ceph.repo
[Ceph]
name=Ceph $basearch
#baseurl=https://download.ceph.com/rpm-octopus/el7/$basearch
baseurl=https://mirrors.cloud.tencent.com/ceph/rpm-octopus/el7/$basearch
enabled=1
gpgcheck=1
gpgkey=https://download.ceph.com/keys/release.asc
[Ceph-noarch]
name=Ceph noarch
baseurl=https://mirrors.cloud.tencent.com/ceph/rpm-octopus/el7/noarch
enabled=1
gpgcheck=1
gpgkey=https://download.ceph.com/keys/release.asc
[Ceph-source]
name=Ceph SRPMS
baseurl=https://mirrors.cloud.tencent.com/ceph/rpm-octopus/el7/SRPMS
enabled=1
gpgcheck=1
gpgkey=https://download.ceph.com/keys/release.asc
清空重来
cephadm rm-cluster --fsid fe9d6a80-8d0d-11eb-8e77-080027c37478 --force
rm -rf /etc/ceph/
rm -rf ~/.ssh
rm -rf ~/tmp/*
参考资料
http://docs.ceph.org.cn/start/quick-start-preflight/
报错记录
Deploying mon service with default placement...
Deploying mgr service with default placement...
Deploying crash service with default placement...
Enabling mgr prometheus module...
Deploying prometheus service with default placement...
Deploying grafana service with default placement...
Deploying node-exporter service with default placement...
Deploying alertmanager service with default placement...
Enabling the dashboard module...
Waiting for the mgr to restart...
Waiting for Mgr epoch 13...
Mgr epoch 13 is available
Generating a dashboard self-signed certificate...
Creating initial admin user...
Non-zero exit code 22 from /usr/bin/docker run --rm --ipc=host --net=host --entrypoint /usr/bin/ceph -e CONTAINER_IMAGE=docker.io/ceph/ceph:v15 -e NODE_NAME=xpc102 -v /var/log/ceph/a27eaf1a-8e17-11eb-9b50-080027c16cb7:/var/log/ceph:z -v /tmp/ceph-tmp0dtvov2l:/etc/ceph/ceph.client.admin.keyring:z -v /tmp/ceph-tmprwthmo2z:/etc/ceph/ceph.conf:z -v /tmp/ceph-tmpovhu0pbr:/tmp/dashboard.pw:z docker.io/ceph/ceph:v15 dashboard ac-user-create admin -i /tmp/dashboard.pw administrator --force-password --pwd-update-required
/usr/bin/ceph: stderr Error EINVAL: Traceback (most recent call last):
/usr/bin/ceph: stderr File "/usr/share/ceph/mgr/mgr_module.py", line 1179, in _handle_command
/usr/bin/ceph: stderr return CLICommand.COMMANDS[cmd['prefix']].call(self, cmd, inbuf)
/usr/bin/ceph: stderr File "/usr/share/ceph/mgr/mgr_module.py", line 318, in call
/usr/bin/ceph: stderr return self.func(mgr, **kwargs)
/usr/bin/ceph: stderr TypeError: ac_user_create_cmd() got an unexpected keyword argument 'inbuf'
/usr/bin/ceph: stderr
Traceback (most recent call last):
File "/usr/sbin/cephadm", line 6151, in <module>
r = args.func()
File "/usr/sbin/cephadm", line 1410, in _default_image
return func()
File "/usr/sbin/cephadm", line 3259, in command_bootstrap
cli(cmd, extra_mounts={pathify(tmp_password_file.name): '/tmp/dashboard.pw:z'})
File "/usr/sbin/cephadm", line 3027, in cli
).run(timeout=timeout)
File "/usr/sbin/cephadm", line 2668, in run
self.run_cmd(), desc=self.entrypoint, timeout=timeout)
File "/usr/sbin/cephadm", line 1071, in call_throws
raise RuntimeError('Failed command: %s' % ' '.join(command))
RuntimeError: Failed command: /usr/bin/docker run --rm --ipc=host --net=host --entrypoint /usr/bin/ceph -e CONTAINER_IMAGE=docker.io/ceph/ceph:v15 -e NODE_NAME=xpc102 -v /var/log/ceph/a27eaf1a-8e17-11eb-9b50-080027c16cb7:/var/log/ceph:z -v /tmp/ceph-tmp0dtvov2l:/etc/ceph/ceph.client.admin.keyring:z -v /tmp/ceph-tmprwthmo2z:/etc/ceph/ceph.conf:z -v /tmp/ceph-tmpovhu0pbr:/tmp/dashboard.pw:z docker.io/ceph/ceph:v15 dashboard ac-user-create admin -i /tmp/dashboard.pw administrator --force-password --pwd-update-required
[root@xpc102 ~]#