便民 发表于 2017-12-4 19:30:53

Openstack云平台实践


  计算,网络,存储模块化
  环境准备(参考https://www.unixhot.com/article/64)
  Centos7.0
  1,安装rpel仓库
  rpm -ivh http://mirrors.aliyun.com/epel/epel-release-latest-7.noarch.rpm
  2,安装OpenStack仓库
  yum install -y centos-release-openstack-mitaka
  3,安装OpenStack客户端
  yum install -y python-openstackclient
  4,安装openstack Selinux管理包
  yum install -y openstack-selinux
  MySQL数据库部署
  yum install -y mariadb mariadb-server python2-PyMySQL
  配置
  cd /etc/my.cnf.d
  vim openstack.cnf




bind-address = 10.0.0.151
default-storage-engine = innodb
innodb_file_per_table
max_connections = 4096
collation-server = utf8_general_ci
character-set-server = utf8

  配置参考文档https://docs.openstack.org/mitaka/zh_CN/install-guide-rdo/index.html
  启动mysql
  systemctl start mariadb
  systemctl enable mariadb
  创建数据库
  mysql -uroot -p123456
  create database keystone;
  grant all on keystone.* to keystone@'localhost' identified by 'keystone';
  grant all on keystone.* to keystone@'%' identified by 'keystone';
  create database glance;
  grant all on glance.* to glance@'localhost' identified by 'glance';
  grant all on glance.* to glance@'%' identified by 'glance';
  create database nove;
  grant all on nova.* to nova@'localhost' identified by 'nova';
  grant all on nova.* to nova@'%' identified by 'nova';
  create database nove_api;
  grant all on nova_api.* to nova@'loaclhost' identified by 'nova';
  grant all on nova_api.* to nova@'%' identified by 'nova';
  create database neutron;
  grant all on neutron.* to neutron@'localhost' identified by 'neutron';
  grant all on neutron.* to neutron@'%' identified by 'neutron';
  安装消息队列RabbitMQ
  yum -y install rabbitmq-server
  设置开机自启动
  systemctl enable rabbitmq-server
  systemctl start rabbitmq-server
  PS:如果启动出现这个错误
  Job for rabbitmq-server.service failed because the control process exited with error code. See "systemctl status rabbitmq-server.service" and "journalctl -xe" for details
  关闭selinux 配置好hosts
  添加openstack用户
  rabbitmqctl add_user openstack openstack
  用户名和密码都为openstack
  给openstack授权
  rabbitmqctl set_permissions openstack ".*" ".*" ".*"
  查看插件
  rabbitmq-plugins list
  启用web界面插件
  rabbitmq-plugins enable rabbitmq_management

  启动15672端口

  http://10.0.0.151:15672/
  默认用户 guest guest

  Openstack验证服务KeyStone
  yum -y install openstack-keystone httpd mod_swgi memcached python-memcached
  配置admin_token
  vim /etc/keystone/keystone.conf

  PS:随机值由命令openssl rand -hex 10 生成
  配置数据库

  connection = mysql+pymysql://keystone:keystone@10.0.0.151/keystone
  PS:三个keystone分别代表用户名,密码,库名
  配置Fernet UUID令牌的提供者

  配置memcached


  查看所有配置

  初始化数据库
  su -s /bin/sh -c "keystone-manage db_sync" keystone
  PS:会自动读取keystone配置文件创建数据库表

  PS:同步的日志文件 /var/log/keystone/keystone.log
  初始化Fernet keys

keystone-manage fernet_setup --keystone-user keystone --keystone-group keystone



  在这个目录生成证书
  启动memcached
  systemctl enable memcached
systemctl start memcached
  配置文件

  配置apache
  vim /etc/httpd/conf/httpd.conf

  PS:必须修改否则会出现奇怪的问题
  vim /etc/httpd/conf.d/wsgi-keystone.conf



Listen 5000
Listen 35357
<VirtualHost *:5000>
WSGIDaemonProcess keystone-public processes=5 threads=1 user=keystone group=keystone display-name=%{GROUP}
WSGIProcessGroup keystone-public
WSGIScriptAlias / /usr/bin/keystone-wsgi-public
WSGIApplicationGroup %{GLOBAL}
WSGIPassAuthorization On
ErrorLogFormat "%{cu}t %M"
ErrorLog /var/log/httpd/keystone-error.log
CustomLog /var/log/httpd/keystone-access.log combined
<Directory /usr/bin>
Require all granted
</Directory>
</VirtualHost>
<VirtualHost *:35357>
WSGIDaemonProcess keystone-admin processes=5 threads=1 user=keystone group=keystone display-name=%{GROUP}
WSGIProcessGroup keystone-admin
WSGIScriptAlias / /usr/bin/keystone-wsgi-admin
WSGIApplicationGroup %{GLOBAL}
WSGIPassAuthorization On
ErrorLogFormat "%{cu}t %M"
ErrorLog /var/log/httpd/keystone-error.log
CustomLog /var/log/httpd/keystone-access.log combined
<Directory /usr/bin>
Require all granted
</Directory>
</VirtualHost>

  启动systemctl start httpd
  报错了 明天再看
页: [1]
查看完整版本: Openstack云平台实践