Ceph cluster installation
Cluster size: 1 monitor, 2 osd machines
Monitor- | _ 172.16.x.x (ip2,10.1.x.x/24) ceph01
| |-osd1 _ 172.16.x.x (ip2,10.1.x.x/24) ceph02 |
| |-osd2 _ 172.16.x.x (ip2,10.1.x.x/24) ceph03 |
1. Preparatory work
All nodes update the system and install ceph-deploy
Sudo yum update & & sudo yum install ceph-deploy
All nodes install ntp,ssh
Sudo yum install ntp ntpdate ntp-doc
Sudo yum install openssh-server
The ceph management machine must log in to all permissions as an ordinary user, so ceph users should have sudo permissions without passwords
1 > create a normal ceph user
Ansible all-m shell-a 'useradd ceph & & echo "ceph" | passwd-- stdin ceph'
2 > make sure the node has sudo permissions
Echo "ceph ALL = (root) NOPASSWD:ALL" | sudo tee / etc/sudoers.d/ceph
Sudo chmod 0440 / etc/sudoers.d/ceph
3 > generate the key of Ceph users and go to each machine to be secret-free.
Ssh-copy-id ceph@ceph01
Ssh-copy-id ceph@ceph02
Ssh-copy-id ceph@ceph03
4 > config file of ceph to ensure that config permission is 600 and ssh ceph01 ceph02 ceph03 is allowed.
/ home/ceph/.ssh & & touch config & & chmod 600. / config
5 > all firewalls are turned off
Ansible all-m shell-a "systemctl disabled firewalld & & systemctl stop firewalld & & setenforce 0"
6 > install yum-plugin on centos
Yum install yum-plugin-priorities
2. Ceph-cluster installation
1 > create a directory and enter the implementation directory my-cluster
Su ceph & & cd & & mkdir my-cluster & & cd my-cluster
2 > create a cluster, execute the following command to generate three files (ceph configuration file, monitor key, log file)
Ceph-deploy new ceph01
3 > modify the default number of copies\ Nic
Osd pool default size = 2
Public network = 172.16.x.0/24 provides access to the outside world
Cluster network = 10.1.x.0/24 internal heartbeat
4 > install ceph
Ceph-deploy install ceph01 ceph02 ceph03
5 > configure the initial monitor (s), collect all keys, and collect
Ceph-deploy mon create-initial
Ceph-deploy gatherkeys ceph01
6 > View node disks and initialize all node disks
Ceph-deploy disk list ceph02
Ceph-deploy disk zap cehp02:sdb
7. Activate osd
Ceph-disk activate-all
Or it can be executed on the deployment machine, and all osd nodes must be executed to ensure that they can join the cluster normally.
Ceph-deploy osd prepare ceph02:/dev/sdb:/dev/sdc
Ceph-deploy osd activate ceph02:/dev/sdb1:/dev/sdc1
8. Cluster status