openstack pike + ceph +高可用集成 -- Cinder控制节点集群 (十二)
###################################################### #以下在controller1节点安装配置 #创建Nova数据库、用户 #mysql -u root -p create database cinder; grant all privileges on cinder.* to 'cinder'@'localhost' identified by 'cinder'; grant all privileges on cinder.* to 'cinder'@'%' identified by 'cinder'; flush privileges;exit; # keystone创建cinder用户、服务、API source ./admin-openstack.sh openstack user create --domain default --password=cinder cinder openstack role add --project service --user cinder admin openstack service create --name cinderv2 --description "OpenStack Block Storage" volumev2 openstack service create --name cinderv3 --description "OpenStack Block Storage" volumev3 openstack endpoint create --region RegionOne volumev2 public http://controller:8776/v2/%\(project_id\)s openstack endpoint create --region RegionOne volumev2 internal http://controller:8776/v2/%\(project_id\)s openstack endpoint create --region RegionOne volumev2 admin http://controller:8776/v2/%\(project_id\)s openstack endpoint create --region RegionOne volumev3 public http://controller:8776/v3/%\(project_id\)s openstack endpoint create --region RegionOne volumev3 internal http://controller:8776/v3/%\(project_id\)s openstack endpoint create --region RegionOne volumev3 admin http://controller:8776/v3/%\(project_id\)s ###################################################### #安装Cinder yum install openstack-cinder -y #可以所有controller节点同时安装 省时间 cp /etc/cinder/cinder.conf{,.bak}
#配置 echo '
[DEFAULT] osapi_volume_listen = controller1 osapi_volume_listen_port = 8776 auth_strategy = keystone log_dir = /var/log/cinder state_path = /var/lib/cinder glance_api_servers = http://controller:9292 transport_url = rabbit://openstack:openstack@controller [database] connection = mysql+pymysql://cinder:cinder@controller/cinder [keystone_authtoken] auth_uri = http://controller:5000 auth_url = http://controller:35357 memcached_servers = controller1:11211,controller2:11211,controller3:11211 auth_type = password project_domain_name = default user_domain_name = default project_name = service username = cinder password = cinder [oslo_concurrency] lock_path = /var/lib/cinder/tmp
'>/etc/cinder/cinder.conf
#配置nova echo ' [cinder] os_region_name = RegionOne '>>/etc/nova/nova.conf
#初始化数据库 su -s /bin/sh -c "cinder-manage db sync" cinder mysql -h controller -u cinder -pcinder -e "use cinder;show tables;" #检测
#haproxy高可用配置 echo ' #Cinder_API_cluster listen Cinder_API_cluster bind controller:8776 #balance source option tcpka option httpchk option tcplog server controller1 controller1:8776 check inter 2000 rise 2 fall 5 server controller2 controller2:8776 check inter 2000 rise 2 fall 5 server controller3 controller3:8776 check inter 2000 rise 2 fall 5 '>>/etc/haproxy/haproxy.cfg systemctl restart haproxy.service netstat -antp|grep haproxy
#启动服务 systemctl restart openstack-nova-api.service systemctl enable openstack-cinder-api.service openstack-cinder-scheduler.service systemctl start openstack-cinder-api.service openstack-cinder-scheduler.service netstat -antp|grep 8776 #cheack
#集群节点controller2安装配置Cinder #安装 yum install openstack-cinder -y ##前面已经安装 cp /etc/cinder/cinder.conf{,.bak} #配置nova echo ' [cinder] os_region_name = RegionOne '>>/etc/nova/nova.conf #同步controller1配置并修改 Node=controller2 rsync -avzP -e 'ssh -p 22' controller1:/etc/cinder/cinder.conf /etc/cinder/ rsync -avzP -e 'ssh -p 22' controller1:/etc/haproxy/* /etc/haproxy/ sed -i '1,8s/controller1/'$Node'/' /etc/cinder/cinder.conf #启动服务 systemctl restart openstack-nova-api.service systemctl enable openstack-cinder-api.service openstack-cinder-scheduler.service systemctl start openstack-cinder-api.service openstack-cinder-scheduler.service netstat -antp|grep 8775 #cheack
###################################################### #集群节点controller3安装配置Cinder #安装 yum install openstack-cinder -y #起那么已经安装 cp /etc/cinder/cinder.conf{,.bak} #配置nova echo ' [cinder] os_region_name = RegionOne '>>/etc/nova/nova.conf #同步controller1配置并修改 Node=controller3 rsync -avzP -e 'ssh -p 22' controller1:/etc/cinder/cinder.conf /etc/cinder/ rsync -avzP -e 'ssh -p 22' controller1:/etc/haproxy/* /etc/haproxy/ sed -i '1,8s/controller1/'$Node'/' /etc/cinder/cinder.conf #启动服务 systemctl restart openstack-nova-api.service systemctl enable openstack-cinder-api.service openstack-cinder-scheduler.service systemctl start openstack-cinder-api.service openstack-cinder-scheduler.service netstat -antp|grep 8775 #cheack