每个region都有个完整的Openstack部署环境, 有自己的一套服务的endpoint(服务入口)。
不同的region共享一套keystone和horizon来提供访问控制与web操作,regions之间完全隔离,但是多个regions之间共享同一个keystone和dashboard。
多region的实践
openstack多region,就是多套openstack共享一个keystone和horizon,那么很容易想到,在一套openstack的keystone的服务实例中创建另外一个区域的服务入口点,只不过认证的服务endpoint一样罢了,horizon自动识别region。
环境介绍
以我自己的例子,先搭建了两套openstack环境,因为是为了实践,所以我简单的搞了两套allinone的。
A主机是10.133.47.95 ,定义成我的region one;
B主机是10.133.47.20,定义成我的region two。
配置
1.在A主机上创建nova、glance、cinder服务入口endpoint,定义为region two。
[root@zmg ~(keystone_admin)]# keystone endpoint-create --service-id $(keystone service-list | awk '/ compute / {print $2}') --publicurl http://10.133.47.95:5000/v2.0 --internalurl http://10.133.47.95:5000/v2.0 --adminurl http://10.133.47.95:35357/v2.0 --region RegionTwo
[root@zmg ~(keystone_admin)]# keystone endpoint-list|grep
RegionTwo
注意:1.这里的endpoint地址都是主机B上的openstack环境中的服务endpoint。
2.glance,cinder以及其他服务,一样操作。
2.在主机B上对相应的服务配置修改
①编辑nova配置文件,在/etc/nova/nova.conf
auth_uri=http://10.133.47.95:5000/v2.0
identity_uri=http://10.133.47.95:35357
admin_token = 3a64046c0c9a4ef4af3d13819a451461
admin_user=nova
admin_password=cd2b0a687cd14376
admin_tenant_name=services
注:1.原来uri这里是47.20,因为我们要和regionone共享keystone,所以认证url改为主机A上的keystone。
2.admin_token需要增加,也是主机Akeystone配置文件中的,必须要加不然认证没法通过,user和password要和A的文件中的一致。
[neutron]
url=http://10.133.47.20:9696
admin_username=neutron
admin_password=072bdefd676644ca
admin_tenant_name=services
admin_auth_url=http://10.133.47.95:5000/v2.0
2.修改cinder.conf文件
[keystone_authtoken]
auth_uri = http://10.133.47.95:5000/v2.0
region_name = RegionTwo
identity_uri = http://10.133.47.95:35357
admin_user = cinder
admin_password = e3cdaaf26e774509
admin_token = 3a64046c0c9a4ef4af3d13819a451461
admin_tenant_name = services
3.glance配置修改和nova cinder类似,只不过要改api.conf和register.conf。
[keystone_authtoken]
auth_uri=http://10.133.47.95:5000/v2.0
identity_uri=http://10.133.47.95:35357
admin_user=glance
admin_password=bdda12a1e36e4d70
admin_tenant_name=services
admin_token = 3a64046c0c9a4ef4af3d13819a451461
[keystone_authtoken]
auth_uri=http://10.133.47.95:5000/v2.0
identity_uri=http://10.133.47.95:35357
admin_user=glance
admin_password=bdda12a1e36e4d70
admin_token = 3a64046c0c9a4ef4af3d13819a451461
admin_tenant_name=services
总结:要将B机器上所有的验证url都改成A的验证url,另外注意将B中各种配置文件中的token改成A中的admin_token。还有注意两台机器的时间一定要接近,不然还是会出现未授权的错误。
验证:
修改好之后就可以登录到horizon上去看了,horizon不需要修改,它可以自己识别多region。
Region one
Region two
至此,我们就可以通过一个horizon界面去操作不同环境的openstack去创建虚拟机,资源是完全隔离的,是不是很方便了。
以上,是我在完成后再写的步骤,细节的地方可能会有纰漏,但是思路基本就是这样