---
title: 扩容机器配置与安装
description: "关闭本节点防火墙，需在所有Ceph节点和Client节点依次执行如下命令。"
url: https://www.hikunpeng.com/document/detail/zh/kunpengsdss/ecosystemEnable/Ceph/kunpengceph_07_0003.html
sourcePath: /source/zh/kunpengsdss/ecosystemEnable/Ceph/kunpengceph_07_0003.html
indexId: 62f9146a989a0a50263558413a70af1481ffa95b59ed77ad178bf0c975e7b8cd68
---
# 扩容机器配置与安装

#### 关闭防火墙

关闭本节点防火墙，需在所有Ceph节点和Client节点依次执行如下命令。

```
systemctl stop firewalld
systemctl disable firewalld
systemctl status firewalld
```


#### 配置主机名

1. 配置永久静态主机名，主机配置为ceph4~ceph5。
  ceph4节点：

  1 hostnamectl --static set-hostname ceph4

  ceph5节点：

  1 hostnamectl --static set-hostname ceph5

2. 编辑各个服务端和客户端节点的“/etc/hosts”。
  1 vim /etc/hosts

  并添加如下内容： 1 2 3 4 5 6 192.168.3.156 ceph1 192.168.3.157 ceph2 192.168.3.158 ceph3 192.168.3.197 ceph4 192.168.3.198 ceph5 192.168.3.192 client1


#### 配置NTP

Ceph中会自动校验存储节点之间的时间，若不同节点之间时差较大，会有告警，因此执行如下步骤：

1. 安装NTP服务。

  a. 在所有集群和客户端节点安装NTP。
    1 yum -y install ntp ntpdate

  b. 在所有集群和客户端节点备份旧配置。
    1 cd /etc && mv ntp.conf ntp.conf.bak

  c. 以ceph1为NTP服务端节点，在ceph1新建NTP文件。
    1 vim /etc/ntp.conf

    并新增如下内容作为NTP服务端： 1 2 3 4 5 restrict 127.0.0.1 restrict ::1 restrict 192.168.3.0 mask 255.255.255.0 server 127.127.1.0 fudge 127.127.1.0 stratum 8 其中，“restrict 192.168.3.0 mask 255.255.255.0”是ceph1的网段与掩码。

  d. 在ceph4、ceph5及所有客户机节点新建NTP文件。
    1 vim /etc/ntp.conf

    并新增如下内容作为客户端： 1 server 192.168.3.166

  e. 保存并退出。
2. 启动NTP服务。

  a. 在ceph1节点启动NTP服务，并检查状态。
    1 2 3 systemctl start ntpd systemctl enable ntpd systemctl status ntpd

  b. 在除ceph1的所有节点强制同步server（ceph1）时间。
    1 ntpdate ceph1

  c. 在除ceph1的所有节点写入硬件时钟，避免重启后失效。
    1 hwclock -w

  d. 在除ceph1的所有节点安装并启动crontab工具。
    1 2 3 4 yum install -y crontabs chkconfig crond on systemctl start crond crontab -e

  e. 添加以下内容，每隔10分钟自动与ceph1同步时间。
    1 */10 * * * * /usr/sbin/ntpdate 192.168.3.166


#### 配置免密登录

需配置ceph1节点对所有主/客户机节点的免密（包括ceph1本身），此外需要配置client1节点对所有主/客户机节点的免密（包括client1本身）。

1. 在ceph1节点生成公钥，并发放到各个主机/客户机节点。
  1 2 ssh-keygen -t rsa for i in {4..5}; do ssh-copy-id ceph$i; done

2. 在client1节点生成公钥，并发放到各个主机/客户机节点。
  1 2 ssh-keygen -t rsa for i in {4..5}; do ssh-copy-id ceph$i; done


输入命令“ssh-keygen -t rsa”之后，按回车使用默认配置。


#### 设置permissive模式

设置permissive模式，需在所有主客户机节点执行。

- 临时修改，下次重启自动失效，与下一条互补。
  1 setenforce permissive

- 永久设置，下次重启自动生效。
  1 vim /etc/selinux/config

  修改SELINUX=permissive


#### 配置epel源

在所有集群和客户端节点执行下列命令以配置epel源。

```
yum install epel-release -y
```


#### 配置Ceph镜像源

1. 在所有集群和客户端节点建立ceph.repo。
  1 vim /etc/yum.repos.d/ceph.repo

  并加入如下内容：

  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 [Ceph] name=Ceph packages for $basearch baseurl=http://download.ceph.com/rpm-luminous/el7/$basearch enabled=1 gpgcheck=1 type=rpm-md gpgkey=https://download.ceph.com/keys/release.asc priority=1 [Ceph-noarch] name=Ceph noarch packages baseurl=http://download.ceph.com/rpm-luminous/el7/noarch enabled=1 gpgcheck=1 type=rpm-md gpgkey=https://download.ceph.com/keys/release.asc priority=1 [ceph-source] name=Ceph source packages baseurl=http://download.ceph.com/rpm-luminous/el7/SRPMS enabled=1 gpgcheck=1 type=rpm-md gpgkey=https://download.ceph.com/keys/release.asc priority=1

2. 更新yum源。
  1 yum clean all && yum makecache


#### 安装Ceph软件

1. 在原Ceph节点查看当前使用的版本。
  1 ceph -v

  如下图所示：

2. 在新扩容的节点安装相应版本的Ceph软件。
  1 yum -y install ceph*12.2.11 –exclude ceph-debuginfo

3. 扩容节点安装结束后查看版本。
  1 ceph -v

  如下图所示：
