首页 > 网络 > 云计算 >

利用openstack建设适合中小型互联网企业的私有云(五)

2017-01-05

利用openstack建设适合中小型互联网企业的私有。安装openstack环境包,配置mariadb数据库高可用。

利用openstack建设适合中小型互联网企业的私有。安装openstack环境包,配置mariadb数据库高可用:

一、安装openstack环境包

控制节点controller1和controller2:

yum install centos-release-openstack-liberty -y
yum upgrade -y
yum install python-openstackclient openstack-selinux memcached python-memcached cifs-utils quota psmisc pcs pacemaker corosync fence-agents-all resource-agents -y
systemctl enable memcached.service
systemctl start memcached.service
计算节点compute1:

yum install centos-release-openstack-liberty -y

yum upgrade -y
yum install python-openstackclient openstack-selinux -y

二、配置mariadb数据库高可用

控制节点controller1:

cat < /etc/my.cnf.d/galera.cnf
[mysqld]
user=mysql
innodb_file_per_table
max_connections = 4096
collation-server = utf8_general_ci
character-set-server = utf8
binlog_format=ROW
default-storage-engine=innodb
innodb_autoinc_lock_mode=2
wsrep_on=1
wsrep_provider=/usr/lib64/galera/libgalera_smm.so
wsrep_provider_options="gcache.size=1G"
wsrep_cluster_name="openstack_mysql"
wsrep_cluster_address="gcomm://192.168.101.3"
wsrep_node_name=&#39;controller1&#39;
wsrep_node_address=&#39;192.168.101.4&#39;
wsrep_slave_threads=1
wsrep_certify_nonPK=1
wsrep_max_ws_rows=131072
wsrep_max_ws_size=1073741824
wsrep_debug=0
wsrep_convert_LOCK_to_trx=0
wsrep_retry_autocommit=1
wsrep_auto_increment_control=1
wsrep_drupal_282555_workaround=0
wsrep_causal_reads=0
wsrep_notify_cmd=
wsrep_sst_method=rsync
EOF
sed -i &#39;/Group=mysql/a\LimitNOFILE=10000\nLimitNPROC=10000&#39; /usr/lib/systemd/system/mariadb.service
systemctl --system daemon-reload
systemctl enable mariadb.service
mysql_install_db --user=mysql
/usr/libexec/mysqld  --wsrep-new-cluster &
mysql_secure_installation    #设置root密码,其他选Y
控制节点controller2:

cat < /etc/my.cnf.d/galera.cnf
[mysqld]
user=mysql
innodb_file_per_table
max_connections = 4096
collation-server = utf8_general_ci
character-set-server = utf8
binlog_format=ROW
default-storage-engine=innodb
innodb_autoinc_lock_mode=2
wsrep_on=1
wsrep_provider=/usr/lib64/galera/libgalera_smm.so
wsrep_provider_options="gcache.size=1G"
wsrep_cluster_name="openstack_mysql"
wsrep_cluster_address="gcomm://192.168.101.4"
wsrep_node_name=&#39;controller2&#39;
wsrep_node_address=&#39;192.168.101.3&#39;
wsrep_slave_threads=1
wsrep_certify_nonPK=1
wsrep_max_ws_rows=131072
wsrep_max_ws_size=1073741824
wsrep_debug=0
wsrep_convert_LOCK_to_trx=0
wsrep_retry_autocommit=1
wsrep_auto_increment_control=1
wsrep_drupal_282555_workaround=0
wsrep_causal_reads=0
wsrep_notify_cmd=
wsrep_sst_method=rsync
EOF
sed -i &#39;/Group=mysql/a\LimitNOFILE=10000\nLimitNPROC=10000&#39; /usr/lib/systemd/system/mariadb.service
systemctl --system daemon-reload
systemctl enable mariadb.service
systemctl start mariadb.service

控制节点controller1:

killall mysqld && systemctl restart mariadb.service

验证:
# mysql -u root -p111111 -e "SHOW STATUS LIKE &#39;wsrep_cluster_size&#39;;"
+--------------------+-------+
| Variable_name      | Value |
+--------------------+-------+
| wsrep_cluster_size | 2     |
+--------------------+-------+

出现如上即完成mariadb数据库高可用配置
相关文章
最新文章
热点推荐