大家好!这是笔者第一次写博客,如果我的博客帮助到大家了!希望大家多给些鼓励和加油!
大家以后就叫我 J T 就好。
Openstack最重要的组件:Keystone,
keystone在github上是一个单独的项目,Openstack后来将它融入了Openstack体系中,为大家所知。
那今天我就带大家单独的安装,Keystone 这一个组件。
环境:虚拟机ubuntu 1404
root@VM-13-111-ubuntu:/home/ubuntu# ifconfig
eth0 Link encap:Ethernet HWaddr 52:54:00:6f:5c:43
inet addr:10.141.13.111 Bcast:10.141.63.255 Mask:255.255.192.0
inet6 addr: fe80::5054:ff:fe6f:5c43/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2182863 errors:0 dropped:0 overruns:0 frame:0
TX packets:499261 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:237085726 (237.0 MB) TX bytes:60535134 (60.5 MB)
//可见我的虚拟机内网IP为10.141.13.111
一.安装MySQL数据库并创建keystone数据库
# apt-get install mysql-server
一路设置下去
#mysql -u root -p
CREATE DATABASE keystone;
GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'localhost' \
IDENTIFIED BY 'KEYSTONE_DBPASS';
GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'%' \
IDENTIFIED BY 'KEYSTONE_DBPASS';
exit
二.安装keystone组件
#apt-get install python-openstackclient keystone python-keystoneclient
修改keystone的配置文件
需要设置admin_token(这里使用默认值:ADMIN)、public_port、admin_port、public_endpoint、admin_endpoint、keystone验证方式[database]等
# vi /etc/keystone/keystone.conf
admin_token=ADMIN
# The port number which the admin service listens on. (integer
# value)
admin_port=35357
# The port number which the public service listens on.
# (integer value
public_port=5000
admin_endpoint=http://10.141.13.11:%(admin_port)s/
[database]
connection = mysql://keystone:KEYSTONE数据库密码@<数据库主机地址>/keystone
[token]
provider = keystone.token.providers.uuid.Provider
#driver = keystone.token.persistence.backends.sql.Token//这句不能要,否则keystone服务不能正常启动
[DEFAULT]
verbose = True
同步数据库(root模式下)
#keystone-manage db_sync
(同步数据库效果图):
重启keystone服务,让修改好的文件和信息可以正常工作
#service keystone restart
删除keystone默认的SQLite数据库
#rm -f /var/lib/keystone/keystone.db
在root模式下执行
# (crontab -l -u keystone 2>&1 | grep -q token_flush) || \
echo '@hourly /usr/bin/keystone-manage token_flush >/var/log/keystone/
keystone-tokenflush.log 2>&1' \
>> /var/spool/cron/crontabs/keystone
将管理认证信息设置成系统变量,添加到.bashrc文件的末尾
#vim .bashrc
在最后加上
export OS_SERVICE_TOKEN=ADMIN
export OS_SERVICE_ENDPOINT=http://localhost:35357/v2.0
export OS_USERNAME=admin
export OS_PASSWORD=admin
export OS_TENANT_NAME=admin
export OS_AUTH_URL=http://localhost:5000/v2.0
使新增环境变量生效:
Ctrl+D
#source .barshrc
然后创建Tenant,租户名为admin,描述信息为Admin Tenant。请记住该命令生成的Tenant id,下面添加User时需要用到 ;