快速增加controller节点

# controller1节点部署成功后,再添加controller节点,复制配置文件并修改即可
openstack pike 部署 目录汇总 http://www.cnblogs.com/elvi/p/7613861.html
#快速增加controller节点
#controller1节点部署成功后,再添加controller节点,复制配置文件并修改即可

####################################
#环境准备

#配置hostname,hosts文件,配置ssh免密登录,yum安装源
#参考http://www.cnblogs.com/elvi/p/7736521.html

####################################
#配置参数,用于替换

DBPass=open2017      #SQL root密码
Node=controller3     #节点
Netname=ens37        #网卡名称
SetIP=192.168.58.23  #IP地址

####################################
#安装

#OpenStack tools 安装
yum install -y python-openstackclient openstack-selinux \
 python-openstackclient python2-PyMySQL openstack-utils 
#安装Pacemake Corosync
yum install corosync pacemaker pcs fence-agents resource-agents -y
yum install haproxy httpd -y
#MariaDB Galera 安装
yum install mariadb mariadb-server mariadb-galera-server -y
yum install expect -y
#RabbitMQ Cluster 安装群集
yum install rabbitmq-server erlang socat -y
#Keystone安装
yum install -y openstack-keystone httpd mod_wsgi memcached python-memcached
yum install apr apr-util -y
# 安装Glance
yum install -y openstack-glance python-glance
# 安装nova控制节点
yum install -y openstack-nova-api openstack-nova-conductor \
  openstack-nova-console openstack-nova-novncproxy \
  openstack-nova-scheduler openstack-nova-placement-api
#安装neutron
yum install -y openstack-neutron openstack-neutron-ml2 \
 openstack-neutron-linuxbridge python-neutronclient ebtables ipset
#安装dashboard
yum install openstack-dashboard -y
#安装Cinder
yum install openstack-cinder -y
yum install nfs-utils -y #NFS

#########################################
#以下配置需按照前面的集群配置,手动进行
#pacemaker+haproxy配置
#Mariadb Galera Cluster 群集
#RabbitMQ Cluster群集

#########################################
#keystone服务

#memcached启动
cp /etc/sysconfig/memcached{,.bak}
sed -i 's/127.0.0.1/0.0.0.0/' /etc/sysconfig/memcached
systemctl enable memcached.service
systemctl start memcached.service
netstat -antp|grep 11211

rsync -avzP -e 'ssh -p 22' controller1:/usr/share/keystone/* /usr/share/keystone/
rsync -avzP -e 'ssh -p 22' controller1:/etc/keystone/* /etc/keystone/
ln -s /usr/share/keystone/wsgi-keystone.conf /etc/httpd/conf.d/


#################
#镜像服务glance


##########controller1节点使用NFS共享glance存储
systemctl enable rpcbind;systemctl start rpcbind
mkdir -p /date/glance
chown glance:nobody /date/glance
mount -t nfs controller1:/date/glance /date/glance
echo "/usr/bin/mount -t nfs controller1:/date/glance /date/glance">>/etc/rc.local
chmod +x /etc/exports
df -h
##########NFS
rsync -avzP -e 'ssh -p 22' controller1:/etc/glance/* /etc/glance/
sed -i '1,10s/controller1/'$Node'/' /etc/glance/glance-api.conf /etc/glance/glance-registry.conf


#################


#同步controller1节点nova,neutron配置并修改
rsync -avzP -e 'ssh -p 22' controller1:/etc/nova/* /etc/nova/
rsync -avzP -e 'ssh -p 22' controller1:/etc/httpd/conf.d/00-nova-placement-api.conf /etc/httpd/conf.d/
rsync -avzP -e 'ssh -p 22' controller1:/etc/haproxy/* /etc/haproxy/
rsync -avzP -e 'ssh -p 22' controller1:/etc/neutron/* /etc/neutron/
sed -i '1,9s/controller1/'$Node'/' /etc/nova/nova.conf
sed -i '1,9s/controller1/'$Node'/' /etc/neutron/neutron.conf
sed -i 's/192.168.58.21/'$SetIP'/' /etc/neutron/plugins/ml2/linuxbridge_agent.ini
sed -i 's/ens37/'$Netname'/' /etc/neutron/plugins/ml2/linuxbridge_agent.ini


#同步controller1节点cinder配置并修改
rsync -avzP -e 'ssh -p 22' controller1:/etc/cinder/cinder.conf* /etc/cinder/
sed -i '1,8s/controller1/'$Node'/' /etc/cinder/cinder.conf


#dashboard
rsync -avzP -e 'ssh -p 22' controller1:/etc/openstack-dashboard/local_settings* /etc/openstack-dashboard/


#################
#启动服务


#Apache
systemctl enable httpd.service haproxy
systemctl start httpd haproxy
netstat -antp|egrep 'httpd'


#glance服务
systemctl enable openstack-glance-api openstack-glance-registry
systemctl restart openstack-glance-api openstack-glance-registry


#nova服务
systemctl enable openstack-nova-api.service \
openstack-nova-consoleauth.service openstack-nova-scheduler.service \
openstack-nova-conductor.service openstack-nova-novncproxy.service
#启动服务
systemctl start openstack-nova-api.service \
openstack-nova-consoleauth.service openstack-nova-scheduler.service \
openstack-nova-conductor.service openstack-nova-novncproxy.service


#neutron服务
systemctl enable neutron-server.service \
neutron-linuxbridge-agent.service neutron-dhcp-agent.service \
neutron-metadata-agent.service neutron-l3-agent.service
systemctl start neutron-server.service \
neutron-linuxbridge-agent.service neutron-dhcp-agent.service \
neutron-metadata-agent.service neutron-l3-agent.service

#neutron-l3-agent为启动xvlan才需要

#
#启动cinder
systemctl enable openstack-cinder-api.service openstack-cinder-scheduler.service
systemctl start openstack-cinder-api.service openstack-cinder-scheduler.service
#
#完成后,根据需求加入pacemaker集群资源管理
#########################################

posted @ 2017-11-02 23:15 子隐 阅读(...) 评论(...) 编辑 收藏