2-基礎服務(SQl,RabbitMQ)html
openstack pike 安裝 目錄彙總 http://www.cnblogs.com/elvi/p/7613861.htmlpython
##2.基礎服務(MysqlSQL,RabbitMQ) #SQL root密碼 DBPass=open2017 # #------------------ #SQL數據庫 yum install mariadb mariadb-server python2-PyMySQL -y #cp /etc/my.cnf.d/openstack.cnf{,.bak} echo "# [mysqld] bind-address = 0.0.0.0 default-storage-engine = innodb innodb_file_per_table max_connections = 4096 collation-server = utf8_general_ci character-set-server = utf8 #">/etc/my.cnf.d/openstack.cnf #啓動數據庫服務 systemctl enable mariadb.service systemctl start mariadb.service netstat -antp|grep mysqld #mysql_secure_installation #初始化設置密碼,自動交互 [[ -f /usr/bin/expect ]] || { yum install expect -y; } #若沒expect則安裝 /usr/bin/expect << EOF set timeout 30 spawn mysql_secure_installation expect { "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 #測試 mysql -u root -p$DBPass -e "show databases;" [ $? = 0 ] || { echo "mariadb初始化失敗";exit; } #數據庫配置,建立數據庫、用戶受權 #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; select user,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 -y install erlang socat yum install -y rabbitmq-server #啓動 rabbitmq ,端口5672 systemctl enable rabbitmq-server.service systemctl start rabbitmq-server.service rabbitmq-plugins enable rabbitmq_management #啓動web插件端口15672 #添加用戶及密碼 rabbitmqctl add_user admin admin rabbitmqctl set_user_tags admin administrator rabbitmqctl add_user openstack openstack rabbitmqctl set_permissions openstack ".*" ".*" ".*" rabbitmqctl set_user_tags openstack administrator systemctl restart rabbitmq-server.service netstat -antp|grep '5672' # rabbitmq-plugins list #查看支持的插件 # lsof -i:15672 #訪問RabbitMQ,訪問地址是http://ip:15672 #默認用戶名密碼都是guest,瀏覽器添加openstack用戶到組並登錄測試