CentOS 最小安装后配置Ceph集群

CentOS 最小安装后配置Ceph集群

  • 版本信息:
    OS: CentOS 7.9.2009

  • 集群节点信息:

    主机名 业务IP 互联IP
    client 10.10.10.100 10.10.100.100
    node01 10.10.10.101 10.10.100.101
    node02 10.10.10.102 10.10.100.102
    node03 10.10.10.103 10.10.100.103

系统环境准备

升级系统

查看当前版本 cat /etc/redhat-release
清理源 sudo yum clean all
更新软件及内核 sudo yum -y update
只更新软件 sudo yum -y upgrade
查看当前路径 pwd

修改主机名并添加HOSTS记录
  1. 修改主机名
    方法一: hostnamectl set-hostname 主机名
    方法二: vim /etc/hostname
  2. 添加HOSTS记录
    1
    2
    3
    4
    5
    6
    [root@Client ~]# vi /etc/hosts

    10.10.10.100 client client.seko.asia
    10.10.10.101 node01 node01.seko.asia
    10.10.10.102 node02 node02.seko.asia
    10.10.10.103 node03 node03.seko.asia
关闭防火墙及关闭SELinux
  1. 防火墙操作

    • 关闭防火墙
      systemctl stop firewalld
    • 禁用防火墙
      systemctl disable firewalld
    • 临时关闭SElinux
      [root@Client ~]# setenforce 0
  2. 永久关闭SELinux

    1
    [root@Client ~]# vim /etc/sysconfig/selinux 
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    # This file controls the state of SELinux on the system.
    # SELINUX= can take one of these three values:
    # enforcing - SELinux security policy is enforced.
    # permissive - SELinux prints warnings instead of enforcing.
    # disabled - No SELinux policy is loaded.
    SELINUX=disabled
    # SELINUXTYPE= can take one of three values:
    # targeted - Targeted processes are protected,
    # minimum - Modification of targeted policy. Only selected processes are protected.
    # mls - Multi Level Security protection.
    SELINUXTYPE=targeted
SSH 互信
  1. 创建公钥私钥
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
[root@Client ~]# ssh-keygen 
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:BEb9+s9g1HmI1p8VIPid9xi/iVtma+r22sfsALNAcs8 root@Client
The key's randomart image is:
+---[RSA 2048]----+
| .+. .. . |
| . ... . . |
| o.+ . .. |
| . +.B =...|
| S.= E o+o|
| .o . *.oo|
| .o . =*o|
| ..o o===|
| .==*=o|
+----[SHA256]-----+
  1. 传递公钥给其它节点主机
1
[root@Client ~]# ssh-copy-id -i /root/.ssh/id_rsa.pub node01

–记得也传给自己一份

配置时间服务器,保证各个节点的时间一致,如果不一致,系统会警告。
1
[root@Client ~]# vim /etc/chrony.conf
1
2
3
4
5
6
7
8

# Allow NTP client access from local network.
#allow 192.168.0.0/16
allow 10.10.10.0/24

# Serve time even if not synchronized to a time source.
#local stratum 10
local stratum 10
1
2
[root@Client ~]# systemctl enable chronyd.service
[root@Client ~]# systemctl restart chronyd
在其它节点 编辑chrony.conf文件
1
[root@node01 ~]# vi /etc/chrony.conf
修改最上面几行 – >client 作为时间服务器主机
1
2
3
4
5
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
server client iburst
#server 1.centos.pool.ntp.org iburst
#server 2.centos.pool.ntp.org iburst
#server 3.centos.pool.ntp.org iburst

部署ceph 源

1
[root@node03 ~]# yum -y install wget
1
[root@Client ~]# wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
1
[root@Client ~]# rpm -ivh https://mirrors.aliyun.com/ceph/rpm-octopus/el7/noarch/ceph-release-1-1.el7.noarch.rpm
1
[root@Client ~]# vi /etc/yum.repos.d/epel.repo 

添加Ceph源

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
cat << EOF | tee /etc/yum.repos.d/ceph.repo

[Ceph]
name=Ceph packages for $basearch
baseurl=http://mirrors.163.com/ceph/rpm-octopus/el7/$basearch
enabled=1
gpgcheck=1
type=rpm-md
gpgkey=http://mirrors.163.com/ceph/keys/release.asc
priority=1

[Ceph-noarch]
name=Ceph noarch packages
baseurl=http://mirrors.163.com/ceph/rpm-octopus/el7/noarch
enabled=1
gpgcheck=1
type=rpm-md
gpgkey=http://mirrors.163.com/ceph/keys/release.asc
priority=1

[ceph-source]
name=Ceph source packages
baseurl=http://mirrors.163.com/ceph/rpm-octopus/el7/SRPMS
enabled=1
gpgcheck=1
type=rpm-md
gpgkey=http://mirrors.163.com/ceph/keys/release.asc
priority=1
EOF


CentOS 最小安装后配置Ceph集群
http://anximin.github.io/2021/06/24/Linux_ceph_centos7_mini/
作者
Sylar
发布于
2021年6月24日
许可协议