集群应用及配置
集群资源管理软件包括PCS和ETCD。
PCS创建VIP
也可以为这些VIP绑定主机域名解析(步骤略),注意修改网卡名称及IP地址。
pcs resource create mariadbvip ocf:heartbeat:IPaddr2 \ ip=10.10.100.99 cidr_netmask=24 nic=ens33 op monitor interval=30s pcs resource create rabbitmqvip ocf:heartbeat:IPaddr2 \ ip=10.10.100.98 cidr_netmask=24 nic=ens33 op monitor interval=30s pcs resource create httpdvip ocf:heartbeat:IPaddr2 \ ip=10.10.100.97 cidr_netmask=24 nic=ens33 op monitor interval=30s pcs resource create glancevip ocf:heartbeat:IPaddr2 \ ip=10.10.100.96 cidr_netmask=24 nic=ens33 op monitor interval=30s pcs resource create neutronvip ocf:heartbeat:IPaddr2 \ ip=10.10.100.95 cidr_netmask=24 nic=ens33 op monitor interval=30s pcs resource create novavip ocf:heartbeat:IPaddr2 \ ip=10.10.100.94 cidr_netmask=24 nic=ens33 op monitor interval=30s pcs resource create cindervip ocf:heartbeat:IPaddr2 \ ip=10.10.100.93 cidr_netmask=24 nic=ens33 op monitor interval=30s
PCS创建资源
pcs resource create haproxy systemd:httpd --clone interleave=true pcs resource create keystone systemd:httpd --clone interleave=true pcs resource create glance-api systemd:openstack-glance-api --clone interleave=true pcs resource create glance-registry systemd:openstack-glance-registry --clone interleave=true pcs resource create neutron-server systemd:neutron-server --clone interleave=true pcs resource create neutron-linuxbridge systemd:neutron-linuxbridge-agent --clone interleave=true pcs resource create neutron-l3 systemd:neutron-l3-agent --clone interleave=true pcs resource create neutron-dhcp systemd:neutron-dhcp-agent --clone interleave=true pcs resource create neutron-metadata systemd:neutron-metadata-agent --clone interleave=true pcs resource create nova-api systemd:openstack-nova-api --clone interleave=true pcs resource create nova-consoleauth systemd:openstack-nova-consoleauth --clone interleave=true pcs resource create nova-scheduler systemd:openstack-nova-scheduler --clone interleave=true pcs resource create nova-conductor systemd:openstack-nova-conductor --clone interleave=true pcs resource create nova-novncproxy systemd:openstack-nova-novncproxy --clone interleave=true pcs resource create cinder-api systemd:openstack-cinder-api --clone interleave=true pcs resource create cinder-scheduler systemd:openstack-cinder-scheduler --clone interleave=true
也可以通过crm管理集群资源,不过需要安装软件包“crmsh”,创建资源方法如下:
# 将rabbitmq加入集群监控 crm configure primitive rabbitmq-server systemd:rabbitmq-server \ params environment_file="/etc/profile.d/rabbitmq-server.sh" \ op start interval=0s timeout=600 \ op stop interval=0s timeout=120 \ op monitor interval=10 timeout=20 \ meta priority=100 crm configure clone rabbitmq-server-clone rabbitmq-server meta target-role=Started #cat /etc/profile.d/rabbitmq-server.sh #export RABBITMQ_USE_LONGNAME=true # 将haproxy加入集群监控中 crm configure primitive haproxy systemd:haproxy \ op start interval=0s \ op start interval=0s timeout=20s \ op stop interval=0s timeout=20s \ op monitor interval=20s timeout=30s \ meta priority=100 target-role=Started colocation haproxy-with-vip inf: vip:Started haproxy:Started # 将memcached加入集群监控中 crm configure primitive memcached systemd:memcached params \ op monitor interval=30s timeout=30s crm configure clone openstack-dashboard-clone httpd meta crm configure clone openstack-memcached-clone memcached # 将openstack-glance-registry加入集群监控中 crm configure primitive openstack-glance-registry systemd:openstack-glance-registry \ op start interval=0s timeout=45s \ op stop interval=0s timeout=45s \ op monitor interval=30s timeout=30s
PCS定义服务启动顺序
# 定义 neutron pcs constraint order order_neutron-metadata-agent_neutron-dhcp-agent \ neutron-metadata-agent-clone:start neutron-dhcp-agent-clone:start \ symmetrical=true # 定义 memcached + dashboard pcs constraint order order_memcached_httpd openstack-memcached-clone:start\ openstack-dashboard-clone:start \ symmetrical=true # 定义 vip + haproxy + neutron-server pcs constraint order order_vip_haproxy vip:start haproxy:start \ pcs constraint order order_vip_neutron-server vip:start \ openstack-neutron-server-clone:start # 定义 neutron-openvswitch + neutron-metadata pcs constraint order order_neutron-openvswitch-agent_neutron-metadata-agent \ neutron-openvswitch-agent-clone:start neutron-metadata-agent-clone:start \ symmetrical=true # 定义 memcached + nova-consoleauth pcs constraint order order_memcached_nova-consoleauth \ openstack-memcached-clone:start openstack-nova-consoleauth-clone:start\ symmetrical=true # 定义 neutron-metadata + neutron-l3 pcs constraint order order_neutron-metadata-agent_neutron-l3-agent \ neutron-metadata-agent-clone:start neutron-l3-agent-clone:start \ symmetrical=true
ETCD配置
注意:配置中的IP地址不能用主机名代替,各节点需要绑定本机IP。
#[member] ETCD_NAME="controller1" ETCD_DATA_DIR="/var/lib/etcd/default.etcd" ETCD_LISTEN_PEER_URLS="http://10.10.100.150:2380" ETCD_LISTEN_CLIENT_URLS="http://10.10.100.150:2379,http://10.10.100.150:4001" #[cluster] ETCD_INITIAL_ADVERTISE_PEER_URLS="http://10.10.100.150:2380" ETCD_ADVERTISE_CLIENT_URLS="http://10.10.100.150:2379,http://10.10.100.150:4001" ETCD_INITIAL_CLUSTER="controller1=http://10.10.100.150:2380,controller2=http://10.10.100.149:2380,controller3=http://10.10.100.148:2380" ETCD_INITIAL_CLUSTER_TOKEN="etcd-cluster" ETCD_INITIAL_CLUSTER_STATE="new"
原创文章禁止转载:技术学堂 » Openstack云平台搭建课程八·控制节点集群