2-Basic services (SQL,RABBITMQ)
##2. Basic service (MYSQLSQL,RABBITMQ) #SQL root password Dbpass=open2017# #------------------#SQL数据库Yum InstallMARIADB Mariadb-server Python2-pymysql-yCP/etc/my.cnf.d/Openstack.cnf{,.bak}Echo "#[Mysqld]bind-address =0.0.0.0default-storage-engine =innodbinnodb_file_per_tablemax_connections=4096Collation-server =Utf8_general_cicharacter-set-server =utf8#">/etc/my.cnf.d/openstack.cnf#启动数据库服务systemctl enable Mariadb.servicesystemctl start Mariadb.servicenetstat-antp|grepmysqld#mysql_secure_installation #初始化设置密码, automatic interaction [[-f/usr/bin/expect] | | {Yum InstallExpect-y;} #若没expect则安装/usr/bin/expect <<eofset Timeout -Spawn Mysql_secure_installationexpect {"Enter for none"{Send"\ r"; Exp_continue}"y/n"{Send"y\r"; Exp_continue}"Password:"{Send"$DBPass \ r"; Exp_continue}"New Password:"{Send"$DBPass \ r"; Exp_continue}"y/n"{Send"y\r"; Exp_continue} EOF {exit}}eof# test MySQL-U root-p$dbpass-e"show databases;"[ $? =0] || {Echo "MARIADB initialization failed"; exit;} #数据库配置, create DATABASE, user authorization #mysql-U Root-p MySQL-U root-p$dbpass-e"CREATE DATABASE Keystone;grant all privileges on Keystone.* To'Keystone'@'localhost'Identified by'Keystone'; Grant all privileges on Keystone.* To'Keystone'@'%'Identified by'Keystone'; Create database glance;grant all privileges on glance.* To'Glance'@'localhost'Identified by'Glance'; Grant all privileges on glance.* To'Glance'@'%'Identified by'Glance'CREATE DATABASE Nova;grant all privileges on Nova.* To'Nova'@'localhost'Identified by'Nova'Grant all privileges on Nova.* To'Nova'@'%'Identified by'Nova'; Create database nova_api;grant all privileges on Nova_api.* To'Nova'@'localhost'Identified by'Nova'; grant all privileges on NOVA_API.* To'Nova'@'%'Identified by'Nova'; Create database nova_cell0;grant all privileges on nova_cell0.* To'Nova'@'localhost'Identified by'Nova'; grant all privileges on nova_cell0.* To'Nova'@'%'Identified by'Nova'; Create database neutron;grant all privileges on neutron.* To'Neutron'@'localhost'Identified by'Neutron'; grant all privileges on neutron.* To'Neutron'@'%'Identified by'Neutron'; flush privileges;Selectuser,host from mysql.user;show databases;"# # CREATE DATABASE cinder;# grant all privileges on cinder.* To'Cinder'@'localhost'Identified by'Cinder'; # grant all privileges on cinder.* To'Cinder'@'%'Identified by'Cinder';# #------------------Sleep 1# #------------------#RabbitMQ #消息队列Yum-YInstallErlang SocatYum Install-Y rabbitmq-server# start RABBITMQ, port 5672systemctl enable RABBITMQ-server.servicesystemctl start RABBITMQ-SERVER.SERVICERABBITMQ-plugins enable rabbitmq_management #启动web插件端口15672 # Add user and password rabbitmqctl add_user admin adminrabbitmqctl set_user_ Tags admin administratorrabbitmqctl add_user openstack openstack rabbitmqctl set_permissions OpenStack".*" ".*" ".*"rabbitmqctl set_user_tags openstack administratorsystemctl restart RABBITMQ-Server.servicenetstat-antp|grep '5672'# RABBITMQ-plugins List #查看支持的插件 # lsof-I.:15672#访问RabbitMQ, the Access address is http://ip:15672#默认用户名密码都是guest, the browser adds OpenStack users to the group and logs on to the test
# #2. Basic services (SQL,RABBITMQ)--openstack