一、基础环境配置
1.1 网络配置
ubuntu:
network: ethernets:eno1:dhcp4: trueeno2:dhcp4: trueeno3:dhcp4: trueeno4:dhcp4: truebonds:bond0:addresses:- 100.64.0.12/22routes:- to: defaultvia: 100.64.0.1nameservers:addresses:- 114.114.114.114interfaces:- eno1- eno1parameters:mode: 802.3adversion: 2
1.2 修改主机名
hostnamectl set-hostname sd-ceph01
hostnamectl set-hostname sd-ceph02
hostnamectl set-hostname sd-ceph03
hostnamectl set-hostname sd-ceph04
hostnamectl set-hostname sd-ceph05
1.3 配置host文件
cat >> /etc/hosts << EOF
# Ceph public network
10.220.8.46 sd-ceph01
10.220.8.47 sd-ceph02
10.220.8.48 sd-ceph03
10.220.8.45 sd-ceph04
10.220.8.49 sd-ceph05
EOF#安装网络规划
#public network(万兆)
100.64.4.66
#cluster network 25G
192.168.100.xxx
1.4 配置时间同步
# 安装chrony
yum -y install chrony# 启动服务并设置为开机启动(必须执行enable)
systemctl start chronyd
systemctl enable chronyd# 查看系统时钟:
[root@nas-12 ~]# timedatectl statusLocal time: Wed 2024-01-10 10:43:34 CSTUniversal time: Wed 2024-01-10 02:43:34 UTCRTC time: Wed 2024-01-10 02:43:34Time zone: Asia/Shanghai (CST, +0800)
System clock synchronized: yesNTP service: activeRTC in local TZ: no# 如果时区不是上海时区,设置上海时区:
sudo timedatectl set-timezone Asia/Shanghai# 如果修改时区后,时区一致,但是时间不一致,一个时间带PM 另外一个不带
[root@nvme02 ~]# date
Fri Mar 1 15:56:12 CST 2024
[root@nvme03 ~]# date
Fri Mar 1 03:56:07 PM CST 2024# 在环境变量 ~/.bashrc中加入下面命令
vi ~/.bashrc
# 添加下面内同
alias date='date "+%a %b %d %H:%M:%S %Z %Y"'
# 执行生效
source ~/.bashrc#主节点
# 如何想将所有节点和master节点时间同步
vi /etc/chrony.conf
# 添加下面内容
allow 0/0#从节点
# 如何想将所有节点和master节点时间同步
vi /etc/chrony.conf
# 添加下面内容
server sd-ceph01 iburst# 重启服务
systemctl restart chronyd#查看同步是否成功
[root@node1 ~]# chronyc sources
MS Name/IP address Stratum Poll Reach LastRx Last sample
===============================================================================
^* master 10 6 7 2 -63ns[+2859ms] +/- 26us
二、安装ceph集群
2.1 安装podman
dapt install -y podman
或者
apt install -y docker-cedocker安装配置:
如果已经安装建议先卸载Docker或者Docker CE:
sudo apt-get remove docker docker-engine docker.io containerd runc
添加Docker GPG密钥:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
设置Docker存储库:
echo &#