Ceph基本环境配置

基本环境准备

准备三台服务器(服务器至少需要添加两块磁盘)以及一台客户端,最好配置时间同步同时再次配置hosts解析。

node1 192.168.134.160
node2 192.168.134.161
node3 192.168.134.162
node4 192.168.134.163 客户端

配置免密登录

[root@node1 ~]# ssh-keygen -f ~/.ssh/id_rsa -P '' -q
[root@node1 ~]# ssh-copy-id node1
[root@node1 ~]# ssh-copy-id node2
[root@node1 ~]# ssh-copy-id node3
[root@node1 ~]# ssh-copy-id node4

配置扩展源同时进行部分必需软件安装(三个服务器都需要配置)

[root@node1 ~]#  wget -O /etc/yum.repos.d/epel.repo https://mirrors.aliyun.com/repo/epel-7.repo
[root@node1 ~]# yum install python-pip ansible git -y
[root@node1 ~]# yum install python-netaddr unzip python36-six.noarch python36-PyYAML.x86_64 ansible -y
[root@node1 ~]# pip3 install pecan
[root@node1 ~]# pip3 install werkzeug

正式部署ceph集群

以下操作均在node1节点完成

克隆存储库

[root@node1 ~]# git clone https://github.com/ceph/ceph-ansible.git
[root@node1 ~]# cd ceph-ansible
[root@node1 ceph-ansible]# git checkout stable-4.0

修改ansible的hosts主机文件并且进行主机清单添加,同时使用以下命令检查,判断是否正确。

[root@node1 ceph-ansible]# vim /etc/ansible/hosts
[root@node1 ceph-ansible]# ansible-inventory --graph
[WARNING]: log file at /root/ansible/ansible.log is not writeable and we cannot create it, aborting

@all:
  |--@clients:
  |  |--node4
  |--@grafana-server:
  |  |--node1
  |  |--node2
  |  |--node3
  |--@mdss:
  |  |--node1
  |  |--node2
  |  |--node3
  |--@mgrs:
  |  |--node1
  |--@mons:
  |  |--node1
  |  |--node2
  |  |--node3
  |--@osds:
  |  |--node1
  |  |--node2
  |  |--node3
  |--@rgws:
  |  |--node1
  |--@ungrouped:

测试是否可以管理

[root@node1 ceph-ansible]# ansible all -m ping
node2 | SUCCESS => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python"
    }, 
    "changed": false, 
    "ping": "pong"
}
node4 | SUCCESS => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python"
    }, 
    "changed": false, 
    "ping": "pong"
}
node1 | SUCCESS => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python"
    }, 
    "changed": false, 
    "ping": "pong"
}
node3 | SUCCESS => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python"
    }, 
    "changed": false, 
    "ping": "pong"
}

将" ceph-ansible/group_vars/ "下的文件全部备份,修改" ceph-ansible/group_vars/all.yml "的配置

[root@node1 ceph-ansible]# cd group_vars
[root@node1 group_vars]# for file in *;do cp $file ${file%.*};done

修改过的内容如下:


[root@node1 ceph-ansible]# cd group_vars/
 
[root@node1 group_vars]# vim all.yml
修改后的内容:
---
dummy:
mon_group_name: mons
osd_group_name: osds
rgw_group_name: rgws
mds_group_name: mdss
client_group_name: clients
mgr_group_name: mgrs
grafana_server_group_name: grafana-server
configure_firewall: False
ceph_origin: repository
ceph_origin: repository
ceph_repository: community
ceph_mirror: http://mirrors.aliyun.com/ceph
ceph_stable_key: http://mirrors.aliyun.com/ceph/keys/release.asc
ceph_stable_release: nautilus
ceph_stable_repo: "{{ ceph_mirror }}/rpm-{{ ceph_stable_release }}"
public_network: "192.168.134.0/24"
cluster_network: "192.168.134.0/24"
monitor_interface: ens33
osd_auto_discovery: true
osd_objectstore: filestore
radosgw_interface: ens33  # 此处配置错误会出现报错:msg: Either radosgw_address, radosgw_address_block or radosgw_interface must be provided
dashboard_admin_password: ans123456
grafana_admin_password: admin
dshboard_enabled: False # 此处配置错误会出现CENTOS release not supported 7 with dashboard

 修改 " ceph-ansible/group_vars/osds.yml "配置:

[root@node1 group_vars]# vim osds.yml
.......
devices:
- /dev/sdb

备份" ceph-ansible/site.yml ",再修改" ceph-ansible/site.yml "配置


[root@node1 ceph-ansible]# vim site.yml 
---
 
- hosts:
  - mons 
  - osds
  - mdss
  - rgws
  #- nfss
  #- rbdmirrors
  - clients
  - mgrs
  #- iscsigws
  - grafana-server

执行启动即可

[root@node1 ceph-ansible]# ansible-playbook site.yml

健康检查

检查是否部署成功

[root@node1 ~]# ceph health
HEALTH_WARN mons are allowing insecure global_id reclaim  # 该提示部署成功

你可能感兴趣的:(ceph,服务器,运维)