共计 5118 个字符,预计需要花费 13 分钟才能阅读完成。
Ubuntu 16.04 快速安装 Ceph 集群
准备工作
-
假设集群: 选一台作管理机
注意: ceph 集群引用 hostname, 而非 ip.172.17.4.16 linuxidc16 #hostname必须是linuxidc16 172.17.4.17 linuxidc17 #hostname必须是linuxidc17 172.17.4.18 linuxidc18 #hostname必须是linuxidc18 172.17.4.19 linuxidc19 #hostname必须是linuxidc19, 选作管理机 172.17.4.20 linuxidc20 #hostname必须是linuxidc20 172.17.4.21 linuxidc21 #hostname必须是linuxidc21 172.17.4.22 linuxidc22 #hostname必须是linuxidc22
-
安装用户
注意: 建议不要使用 ”ceph”, 因为 ”apt install ceph” 需要使用 ceph. 用 root 最省事 ^_^root@linuxidc19:~# ssh-keygen #创建安装用 rsa, 安装完记得删除 root@linuxidc19:~# less .ssh/id_rsa.pub ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDZAQ8ikono13kGzRLpyx1BCRfzICieEKg27WABW+2eFkYXmbvzLSu8XkmC3a0x7M0ADd2aW2FGv8ZtxPgHMRFzyaeoXwGZUFU5zmd9CASglHibKlWzdUgl5sW/DSdSxFYs+ooQvZcKSMmbFYlo70Ndv5kHja2FEMKnLexJpox4fFb9Rv1KEez0p1j28iICc3nHXLAZigezKkaFiv/Wfk/g59nk6ZCNAr1UnDvTdQOnVTIu6Q6UkpoiDx3+R5oeWRynI2l6T/bhrMpubO5PaluFKvas0DF3eGZLf2XQPR8sYzt7PkOGC1QANi7D11UxTqurZF8Meb0LdH0KEqE1kH7z root@cadmin # 在各台机执行,authorized_keys 必须是 600 mkdir /root/.ssh echo -n 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDZAQ8ikono13kGzRLpyx1BCRfzICieEKg27WABW+2eFkYXmbvzLSu8XkmC3a0x7M0ADd2aW2FGv8ZtxPgHMRFzyaeoXwGZUFU5zmd9CASglHibKlWzdUgl5sW/DSdSxFYs+ooQvZcKSMmbFYlo70Ndv5kHja2FEMKnLexJpox4fFb9Rv1KEez0p1j28iICc3nHXLAZigezKkaFiv/Wfk/g59nk6ZCNAr1UnDvTdQOnVTIu6Q6UkpoiDx3+R5oeWRynI2l6T/bhrMpubO5PaluFKvas0DF3eGZLf2XQPR8sYzt7PkOGC1QANi7D11UxTqurZF8Meb0LdH0KEqE1kH7z' > /root/.ssh/authorized_keys && chmod 600 /root/.ssh/authorized_keys
测试用户
# 在 linuxidc19 无密 ssh for node in 16 17 18 19 20 21 22; do ssh linuxidc$node echo 123; done; # 确认 yes The authenticity of host 'linuxidc22 (172.17.4.22)' can't be established. ECDSA key fingerprint is SHA256:6S9mp0m8bV15bKX9RugP2CflINUvxORw82yCwJqVyrE. Are you sure you want to continue connecting (yes/no)? yes
完成后记得将 /root/.ssh/id_rsa 从 linuxidc19 移除并妥善保管, 以后可以用来维护集群.
-
更新源
root@linuxidc19: for node in 16 17 18 19 20 21 22; do ssh linuxidc$node \ wget -q -O- https://download.ceph.com/keys/release.asc | sudo apt-key add -;\ echo deb https://download.ceph.com/debian-jewel/ $(lsb_release -sc) main | sudo tee /etc/apt/sources.list.d/ceph.list;\ apt update && apt -y dist-upgrade && apt -y autoremove; done #apt 使用 - y 默认 Yes
-
安装 ceph-deploy
root@linuxidc19: apt install ceph-deploy
注意: 16.04 下这二个版本都有 bug.
- 1.5.32 在执行 ceph-deploy mon create-initial 命令后生成的 ceph.client.admin.keyring 文件是空的!
-
1.5.34 则在重装时不会替换 /var/lib/ceph/bootstrap-osd/ceph.keyring, 造成 ceph-deploy osd activate 失败.
root@linuxidc19:~# apt-cache policy ceph-deploy ceph-deploy: Installed: 1.5.34 Candidate: 1.5.34 Version table: *** 1.5.34 999 999 https://download.ceph.com/debian-jewel xenial/main amd64 Packages 999 https://download.ceph.com/debian-jewel xenial/main i386 Packages 100 /var/lib/dpkg/status 1.5.32-0ubuntu1 500 500 http://hk.archive.ubuntu.com/ubuntu xenial/universe amd64 Packages 500 http://hk.archive.ubuntu.com/ubuntu xenial/universe i386 Packages
安装过程
参考: INSTALLATION (QUICK)
-
创建管理目录
root@linuxidc19:~# mkdir ceph-admin root@linuxidc19:~# cd ceph-admin/
-
初始配置
root@linuxidc19:~/ceph-admin# ceph-deploy new linuxidc16 test17 drwxr-xr-x 2 root root 4096 Sep 14 10:28 ./ drwx------ 6 root root 4096 Sep 14 10:28 ../ -rw-r--r-- 1 root root 215 Sep 14 10:28 ceph.conf -rw-r--r-- 1 root root 4080 Sep 14 10:28 ceph-deploy-ceph.log -rw------- 1 root root 73 Sep 14 10:28 ceph.mon.keyring root@linuxidc19:~/ceph-admin# vi ceph.conf [global] fsid = c96ee478-4df7-4100-9792-c078cf44b3c4 mon_initial_members = linuxidc16, test17 mon_host = 172.17.4.16,172.17.4.17 auth_cluster_required = cephx auth_service_required = cephx auth_client_required = cephx public_network = 172.17.4.0/24 cluster_network = 172.17.4.0/24 # 以下是针对 ext4 的 bug osd_max_object_name_len = 256 osd_max_object_namespace_len = 64 osd_check_max_object_name_len_on_startup = false
需要注意: jewel 10.2.1 对 EXT4 格式有个文件名长度 BUG!
-
安装 ceph
root@linuxidc19:~/ceph-admin# for node in 16 17 18 19 20 21 22; do ceph-deploy install linuxidc$node; done;
-
创建初始 mon 结点
root@linuxidc19:~/ceph-admin# ceph-deploy mon create-initial
-
创建激活 osd 结点, 去掉 16,17
root@linuxidc19:~/ceph-admin# for node in 18 19 20 21 22; do ssh linuxidc$node 'mkdir -R /data/ceph/osd; chown ceph:ceph -R /data/ceph; rm -rf /data/ceph/osd/*'; ceph-deploy osd prepare linuxidc$node:/data/ceph/osd; ceph-deploy osd activate linuxidc$node:/data/ceph/osd; done;
-
分发管理配置
root@linuxidc19:~/ceph-admin# for node in 16 17 18 19 20 21 22; do ceph-deploy admin linuxidc$node; ssh linuxidc$node 'chmod a+r /etc/ceph/ceph.client.admin.keyring'; done;
如果上述步骤需要重试, 可以执行下述清理:root@linuxidc19:~/ceph-admin# ceph-deploy purgedata linuxidc16 test17 linuxidc18 test19 linuxidc20 test21 linuxidc22 root@linuxidc19:~/ceph-admin# ceph-deploy forgetkeys root@linuxidc19:~/ceph-admin# for node in 16 17 18 19 20 21 22; do ssh linuxidc$node rm -rf /data/ceph/osd/*; done;
另外, 重试命令需要带上 ”–overwrite-conf” 选项!
-
测试集群是否安装成功
root@linuxidc19:~/ceph-admin# ceph -s root@linuxidc19:~/ceph-admin# ceph osd tree root@linuxidc19:~/ceph-admin# ceph osd perf
Ceph 环境配置文档 PDF http://www.linuxidc.com/Linux/2013-05/85212.htm
CentOS 6.3 上部署 Ceph http://www.linuxidc.com/Linux/2013-05/85213.htm
Ceph 的安装过程 http://www.linuxidc.com/Linux/2013-05/85210.htm
HOWTO Install Ceph On FC12, FC 上安装 Ceph 分布式文件系统 http://www.linuxidc.com/Linux/2013-05/85209.htm
Ceph 文件系统安装 http://www.linuxidc.com/Linux/2013-05/85208.htm
CentOS 6.2 64 位上安装 Ceph 0.47.2 http://www.linuxidc.com/Linux/2013-05/85206.htm
Ubuntu 12.04 Ceph 分布式文件系统 http://www.linuxidc.com/Linux/2013-04/82588.htm
Fedora 14 上安装 Ceph 0.24 http://www.linuxidc.com/Linux/2011-01/31580.htm
Ceph 的详细介绍:请点这里
Ceph 的下载地址:请点这里
本文永久更新链接地址:http://www.linuxidc.com/Linux/2016-09/135261.htm