配置主机名

  1. 配置永久静态主机名,服务端配置为ceph1~ceph3,客户端配置为client1~client3。

    1. 配置服务端节点。

      ceph1节点:

      1
      hostnamectl --static set-hostname ceph1
      

      其余节点以此类推。

    2. 同理配置客户端节点。

      client1节点:

      1
      hostnamectl --static set-hostname client1
      

      其余节点以此类推。

  2. 修改域名解析文件。

    1. 打开域名解析文件。
    1
    vi /etc/hosts
    

    2. 按“i”进入编辑模式,在集群内各个服务端节点和客户端节点的“/etc/hosts”中添加如下内容:

    1
    2
    3
    4
    5
    6
    192.168.3.166   ceph1
    192.168.3.167   ceph2
    192.168.3.168   ceph3
    192.168.3.160   client1
    192.168.3.161   client2
    192.168.3.162   client3
    

    3. 按“Esc”键退出编辑模式,输入:wq!,“Enter”键保存并退出文件。

    检查服务端节点和客户节点网络是否已连接成功,正确响应即为修改域名解析文件成功。如登录ceph1节点,在ceph1节点上检查ceph1与ceph2的网络是否能连接成功。

    1
    [root@ceph1 ~]# ping ceph2
    

    返回以下信息即表示成功。

    1
    2
    3
    4
    5
    6
    7
    PING ceph2 (192.168.3.167) 56(84) bytes of data.
    64 bytes from ceph2 (192.168.3.167): icmp_seq=1 ttl=64 time=0.175 ms
    64 bytes from ceph2 (192.168.3.167): icmp_seq=2 ttl=64 time=0.085 ms
    64 bytes from ceph2 (192.168.3.167): icmp_seq=3 ttl=64 time=0.083 ms
    ...
    --- ceph2 ping statistics ---
    3 packets transmitted, 3 received, 0% packet loss, time 2043ms