openstack项目搭建
所有服务器配置
控制端:
内存:5G
vcpu:4
计算节点:
内存:2G
vcpu:2
1. 准备yum源:/etc/yum.repos.d/openstack.repo
yum -y install centos-release-openstack-stein
2. 安装openstack客户端、openstack SELinux管理包
yum -y install python-openstackclient openstack-selinux
一、控制端: 101
安装
yum -y install python2-PyMySQL mariadb
二、数据库106:配置SQL数据库
1. 安装组件
yum -y install mariadb mariadb-server
2. 配置/etc/my.cnf.d/openstack.cnf
[mysqld] bind-address = 192.168.99.116
default-storage-engine = innodb
innodb_file_per_table = on
max_connections = 4096
collation-server = utf8_general_ci
character-set-server = utf8
3. 启动数据库和设置开机启动
systemctl enable mariadb.service
systemctl start mariadb.service
4. 通过运行脚本来保护数据库服务
mysql_secure_installation
三、数据库106:配置Memcached
1. 安装包:
yum -y install memcached python-memcached
2. 编辑/etc/sysconfig/memcached文件
配置服务以使用控制器节点的管理IP地址。这是为了通过网络访问其他节点:
OPTIONS="-l 192.168.99.116"
3. 启动Memcached服务并将其配置为在系统引导时启动:
systemctl enable memcached.service
systemctl start memcached.service
ha_102:配置haproxy+keepalived(ha_1和ha_2都要配置)
1. 安装keepalived和haproxy
yum -y install keepalived haproxy
2. 配置master_keepalived
vrrp_instance VI_1 { state MASTER interface eth0 virtual_router_id 51 priority 100 advert_int 1 unicast_src_ip 192.168.99.112 unicast_peer { 192.168.99.113 } authentication { auth_type PASS auth_pass 1111 } virtual_ipaddress { 192.168.99.100 dev eth0 label eth0:1 } }
3. 启动
systemctl start keepalived
systemctl enable keepalived
4. haproxy配置
global log 127.0.0.1 local2 chroot /var/lib/haproxy pidfile /var/run/haproxy.pid maxconn 4000 user haproxy group haproxy daemon stats socket /var/lib/haproxy/stats defaults mode http log global option httplog option dontlognull option http-server-close option forwardfor except 127.0.0.0/8 option redispatch retries 3 timeout http-request 10s timeout queue 1m timeout connect 10s timeout client 1m timeout server 1m timeout http-keep-alive 10s timeout check 10s maxconn 3000 listen stats mode http bind :9999 stats enable log global stats uri /haproxy-status stats auth admin:123 listen dashboard bind :80 mode http balance source server dashboard 192.168.99.116:80 check inter 2000 fall 3 rise 5 listen mysql bind :3306 mode tcp balance source server mysql 192.168.99.116:3306 check inter 2000 fall 3 rise 5 listen memcached bind :11211 mode tcp balance source server memcached 192.168.99.116:11211 inter 2000 fall 3 rise 5 listen rabbit bind :5672 mode tcp balance source server rabbit 192.168.99.116:5672 inter 2000 fall 3 rise 5 listen rabbit_web bind :15672 mode http server rabbit_web 192.168.99.116:15672 inter 2000 fall 3 rise 5
启动
systemctl restart haproxy
systemctl enable haproxy
5. 配置内核参数
echo "net.ipv4.ip_nonlocal_bind=1" >> /etc/sysctl.conf echo "net.ipv4.ip_forward=1" >> /etc/sysctl.conf
sysctl -p
五、数据库106:安装rabbit-MQ
5672、15672端口
7. 安装
yum -y install rabbitmq-server
启动(端口5672)
systemctl enable rabbitmq-server
systemctl start rabbitmq-server
添加用户和密码
rabbitmqctl add_user openstack 123
rabbitmqctl set_permissions openstack ".*" ".*" ".*"
打开web插件(端口15672)
rabbitmq-plugins enable rabbitmq_management
查看插件
rabbitmq-plugins list
验证:有openstack这个用户
[mysql]$ rabbitmqctl list_users
Listing users
openstack []
guest [administrator]
web访问端口15672,用户密码都是guest
资料来自:https://thson.blog.csdn.net/article/details/100054765