[root@linux-host1 ~]# mv /etc/yum.repo.d/* /tmp/ [root@linux-host1 ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo [root@linux-host1 ~]# yum -y install centos-release-openstack-ocata [root@linux-host1 ~]# yum install python-openstackclient openstack-selinux
安裝mariadbpython
[root@linux-host4 ~]# yum install -y mariadb-server
修改mariadb配置文件mysql
[root@linux-host4 ~]# vim /etc/my.cnf [client-server] [mysqld] socket=/var/lib/mysql/mysql.sock symbolic-links=0 innodb_file_per_table=1 server_id=1 skip_name_resolve [client] port=3306 socket=/var/lib/mysql/mysql.sock !includedir /etc/my.cnf.d [root@linux-host4 ~]# vim /etc/my.cnf.d/openstack.cnf [mysqld] bind-address = 0.0.0.0 #監聽在本機的全部IP地址上 default-storage-engine = innodb innodb_file_per_table = on max_connections = 4096 collation-server = utf8_general_ci character-set-server = utf8
啓動服務linux
[root@linux-host4 ~]# systemctl start mariadb [root@linux-host4 ~]# systemctl enable mariadb
安全加固web
[root@linux-host4 ~]# mysql_secure_installation
安裝memcachesql
[root@linux-host4 ~]# yum -y install memcached
更改配置文件vim
[root@linux-host4 ~]# vim /etc/sysconfig/memcached #監聽端口 PORT="11211" USER="memcached" #最大使用內存 MAXCONN="1024" CACHESIZE="1024" OPTIONS="-l 0.0.0.0,::1"
啓動服務centos
[root@linux-host4 ~]# systemctl start memcached.service [root@linux-host4 ~]# systemctl enable memcached.service
配置主機名解析瀏覽器
[root@linux-host4 ~]# vim /etc/hosts 192.168.8.203 master
安裝RabbitMQ安全
[root@linux-host4 ~]# yum -y install rabbitmq-server
啓動服務負載均衡
[root@linux-host4 ~]# systemctl enable rabbitmq-server.service [root@linux-host4 ~]# systemctl start rabbitmq-server.service
添加 rabbitMQ 客戶端用戶並設置密碼
[root@linux-host4 ~]# rabbitmqctl add_user openstack 123
賦予 openstack 用戶讀寫權限
[root@linux-host4 ~]# rabbitmqctl set_permissions openstack ".*" ".*" ".*"
打開 rabbitMQ 的 web 插件
[root@linux-host4 ~]# rabbitmq-plugins enable rabbitmq_management
查看插件
[root@linux-host4 ~]# rabbitmq-plugins list
用瀏覽器訪問
http:192.168.8.230:15672
更改內核參數
[root@linux-host2 ~]#vim /etc/sysctl.conf net.ipv4.ip_forward = 1 net.ipv4.ip_nonlocal_bind = 1 [root@linux-host2 ~]#sysctl -p
安裝軟件
[root@linux-host2 ~]#yum -y insatll keepalived haprxoy
配置keepalived
[root@linux-host2 ~]#vim /etc/keepalived/keepalived.conf global_defs { notification_email { acassen@firewall.loc failover@firewall.loc sysadmin@firewall.loc } notification_email_from Alexandre.Cassen@firewall.loc smtp_server 192.168.200.1 smtp_connect_timeout 30 router_id lvs1 vrrp_skip_check_adv_addr vrrp_strict vrrp_iptables vrrp_garp_interval 0 vrrp_gna_interval 0 } vrrp_instance VI_1 { state MASTER interface eth0 virtual_router_id 51 priority 100 advert_int 1 authentication { auth_type PASS auth_pass 1111 } virtual_ipaddress { 192.168.8.100 dev eth0 label eth0:0 } }
啓動服務
[root@linux-host2 ~]#systemctl start keepalived.service [root@linux-host2 ~]#systemctl enable keepalived.service
配置haproxy
[root@linux-host2 ~]#vim /etc/haproxy/haproxy.cfg
listen openstack-mysql mode tcp bind 192.168.8.100:3306 log global server 192.168.8.191 192.168.8.191:3306 check inter 3000 fall 2 rise 5 listen openstack-memcached mode tcp bind 192.168.8.100:11211 log global server 192.168.8.191 192.168.8.191:11211 check inter 3000 fall 2 rise 5 listen openstack-rabbitmq mode tcp bind 192.168.8.100:5672 log global server 192.168.8.191 192.168.8.191:5672 check inter 3000 fall 2 rise 5
啓動服務
[root@linux-host2 ~]#systemctl start haproxy [root@linux-host2 ~]#systemctl enable haproxy
更改內核參數
[root@linux-host3 ~]#vim /etc/sysctl.conf net.ipv4.ip_forward = 1 net.ipv4.ip_nonlocal_bind = 1 [root@linux-host3 ~]#sysctl -p
安裝軟件
[root@linux-host3 ~]#yum -y insatll keepalived haprxoy
配置keepalived
[root@linux-host3 ~]#vim /etc/keepalived/keepalived.conf global_defs { notification_email { acassen@firewall.loc failover@firewall.loc sysadmin@firewall.loc } notification_email_from Alexandre.Cassen@firewall.loc smtp_server 192.168.200.1 smtp_connect_timeout 30 router_id lvs1 vrrp_skip_check_adv_addr vrrp_strict vrrp_iptables vrrp_garp_interval 0 vrrp_gna_interval 0 } vrrp_instance VI_1 { state BACKUP interface eth0 virtual_router_id 51 priority 70 advert_int 1 authentication auth_type PASS auth_pass 1111 } virtual_ipaddress { 192.168.8.100 dev eth0 label eth0:0 } }
啓動服務
[root@linux-host3 ~]#systemctl start keepalived.service [root@linux-host3 ~]#systemctl enable keepalived.service
查看VIP地址
[root@linux-host3 ~]#ifconfig eth0:0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.8.100 netmask 255.255.255.255 broadcast 0.0.0.0 ether 00:0c:29:89:46:ab txqueuelen 1000 (Ethernet)
配置haproxy
[root@linux-host3 ~]#vim /etc/haproxy/haproxy.cfg listen openstack-mysql mode tcp bind 192.168.8.100:3306 log global server 192.168.8.191 192.168.8.191:3306 check inter 3000 fall 2 rise 5 listen openstack-memcached mode tcp bind 192.168.8.100:11211 log global server 192.168.8.191 192.168.8.191:11211 check inter 3000 fall 2 rise 5 listen openstack-rabbitmq mode tcp bind 192.168.8.100:5672 log global server 192.168.8.191 192.168.8.191:5672 check inter 3000 fall 2 rise 5
啓動服務
[root@linux-host3 ~]#systemctl start haproxy [root@linux-host3 ~]#systemctl enable haproxy