openstack私有云布署实践【7.2 keystone + memcache (办公网环境)】

本文详细介绍了在两台Controller服务器上部署OpenStack Keystone服务的过程,包括数据库创建、权限设置、组件安装、Memcached配置、HTTPD配置及虚拟主机设置,确保了Keystone服务的高可用性和迁移实例的安全。
摘要由CSDN通过智能技术生成
首先登录controller1创建keystone数据库,并赋于远程和本地访问的权限。
 
mysql -u root -p
CREATE DATABASE keystone;
GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'localhost'   IDENTIFIED BY 'venic8888';
GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'%'  IDENTIFIED BY 'venic8888';
flush PRIVILEGES;
 
2台controller服务器(kxcontrolelr1 kxcontroller2) 安装其它无状态服务的组件,
 
 
yum install openstack-keystone httpd mod_wsgi  memcached python-memcached -y
先开启memcache
systemctl enable memcached.service
systemctl start memcached.service
 
controller1上
vi  /etc/keystone/keystone.conf
 
[DEFAULT]
admin_token = venicchina
verbose = True
[database]
connection = mysql://keystone:venic8888@controller/keystone
[memcache]
servers = controller1:11211
[token]
provider = uuid
driver = memcache
expiration = 86400
caching = true
cache_time = 86400
[revoke]
driver = sql
expiration_buffer = 86400
caching = true
cache_time = 86400
[catalog]
driver = keystone.catalog.backends.sql.Catalog
[identity]
driver = keystone.identity.backends.sql.Identity
 
 
controller2上
vi  /etc/keystone/keystone.conf
[DEFAULT]
admin_token = venicchina
verbose = True
[database]
connection = mysql://keystone:venic8888@controller/keystone
[memcache]
servers = controller2:11211
[token]
provider = uuid
driver = memcache
expiration = 86400
caching = true
cache_time = 86400
[revoke]
driver = sql
expiration_buffer = 86400
caching = true
cache_time = 86400
[catalog]
driver = keystone.catalog.backends.sql.Catalog
[identity]
driver = keystone.identity.backends.sql.Identity
 
 
以上的每个配置中两组黄色底86400的是给token定义失效时间,默认30分钟或1小时,因为有时迁移一些很大的实例时,迁移大200G的时候,时间会超过,到时会有token报错,到时实例就废掉了。加大时长是必须,这里我定义1天超时
 
在其中一台kxcontroller1同步数据库,生成表单
su -s /bin/sh -c "keystone-manage db_sync" keystone
 
---------------------------------------
修改httpd配置
 
controller1上
vi /etc/httpd/conf/httpd.conf
 
ServerName controller1
Listen 80 这一条为以下行:
Listen 10.40.42.1:80#与VIP监听的IP不同
 
controller2上
vi /etc/httpd/conf/httpd.conf
 
ServerName controller2
Listen 80 这一条为以下行:
Listen 10.40.42.2:80#与VIP监听的IP不同
 
 
 
------------------------------------------
controller1上
vi /etc/httpd/conf.d/wsgi-keystone.conf
 
Listen 10.40.42.1:5000
Listen 10.40.42.1: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
    <IfVersion >= 2.4>
      ErrorLogFormat "%{cu}t %M"
    </IfVersion>
    ErrorLog /var/log/httpd/keystone-error.log
    CustomLog /var/log/httpd/keystone-access.log combined
 
    <Directory /usr/bin>
        <IfVersion >= 2.4>
            Require all granted
        </IfVersion>
        <IfVersion < 2.4>
            Order allow,deny
            Allow from all
        </IfVersion>
    </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
    <IfVersion >= 2.4>
      ErrorLogFormat "%{cu}t %M"
    </IfVersion>
    ErrorLog /var/log/httpd/keystone-error.log
    CustomLog /var/log/httpd/keystone-access.log combined
 
    <Directory /usr/bin>
        <IfVersion >= 2.4>
            Require all granted
        </IfVersion>
        <IfVersion < 2.4>
            Order allow,deny
            Allow from all
        </IfVersion>
    </Directory>
</VirtualHost>
 
controller2上
vi /etc/httpd/conf.d/wsgi-keystone.conf
 
Listen 10.40.42.2:5000
Listen 10.40.42.2: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
    <IfVersion >= 2.4>
      ErrorLogFormat "%{cu}t %M"
    </IfVersion>
    ErrorLog /var/log/httpd/keystone-error.log
    CustomLog /var/log/httpd/keystone-access.log combined
 
    <Directory /usr/bin>
        <IfVersion >= 2.4>
            Require all granted
        </IfVersion>
        <IfVersion < 2.4>
            Order allow,deny
            Allow from all
        </IfVersion>
    </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
    <IfVersion >= 2.4>
      ErrorLogFormat "%{cu}t %M"
    </IfVersion>
    ErrorLog /var/log/httpd/keystone-error.log
    CustomLog /var/log/httpd/keystone-access.log combined
 
    <Directory /usr/bin>
        <IfVersion >= 2.4>
            Require all granted
        </IfVersion>
        <IfVersion < 2.4>
            Order allow,deny
            Allow from all
        </IfVersion>
    </Directory>
</VirtualHost>
 
 
2台controller服务启动,加入开机自启
 
# systemctl enable httpd.service
# systemctl start httpd.service
 
验证:在haproxy的页面http://10.40.42.10:8888/stats上查看80 5000 35357端口状态转发是否成功

转载于:https://www.cnblogs.com/veniceslove/p/6285816.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值