码迷,mamicode.com
首页 > 其他好文 > 详细

openstack 装逼之路~keystone部署

时间:2017-02-07 00:58:45      阅读:1386      评论:0      收藏:0      [点我收藏+]

标签:ldap   mmu   sync   方式   png   plugins   ems   官方   ext   

第一:版本信息

技术分享

官网http://docs.openstack.org/newton/install-guide-rdo/keystone.html

我们按照Newton这个版本来部署,其实跟大家讲,openstack基本保持每6个月更新一个版本,面对如此快的版本更迭,我们其实瞅准了一个版本深入研究下去就好,深入到什么层次,为社区提交代码。任何每来一个新版本就去部署一次的主都是傻叉。

第二:部署keystone

参考部署官网:http://docs.openstack.org/newton/install-guide-rdo/

查看系统信息:

[root@localhost ~]# cat /etc/redhat-release 
CentOS Linux release 7.0.1406 (Core) 
[root@localhost ~]# uname -a
Linux localhost.localdomain 3.10.0-123.el7.x86_64 #1 SMP Mon Jun 30 12:09:22 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

准备阶段:

yum -y install centos-release-openstack-newton #安装官方yum源
yum -y upgrade                        #更新
yum -y install python-openstackclient #安装工具
yum -y install openstack-selinux      #安装openstack-selinux包自动管理openstack组件的安全策略

额外补充:

[root@localhost ~]# more /etc/yum.conf 
[main]
cachedir=/newton 新建该目录
keepcache=1  把这个原本是0的改为1,是把yum缓存到本地
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
installonly_limit=5
bugtracker_url=http://bugs.centos.org/set_project.php?project_id=23&ref=http://bugs.centos.org/bug_report_page.php?category=yum
distroverpkg=centos-release

mkdir /newton

部署数据库

keystone支持ldap和mysql作为后端Driver,用来存放用户相关信息,catalog等,这里我们选用mariadb
yum -y install mariadb mariadb-server python2-PyMySQL 

配置

配置文件:/etc/my.cnf.d/openstack.cnf

[mysqld]
bind-address = 192.168.1.120 #本机管理网络ip

default-storage-engine = innodb  #mysql的存储引擎
innodb_file_per_table    #独立表空间
max_connections = 4096 #最大链接数
collation-server = utf8_general_ci  #默认排序规则
character-set-server = utf8 #字符集

启动服务并设置开机自启动且检查状态

[root@localhost ~]# systemctl start mariadb.service
[root@localhost ~]# systemctl enable mariadb.service
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
[root@localhost ~]# systemctl status mariadb.service
● mariadb.service - MariaDB 10.1 database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
   Active: active (running) since Mon 2017-02-06 09:25:17 EST; 16s ago
 Main PID: 43433 (mysqld)
   Status: "Taking your SQL requests now..."
   CGroup: /system.slice/mariadb.service
           └─43433 /usr/libexec/mysqld --basedir=/usr

Feb 06 09:25:16 localhost.localdomain mysql-prepare-db-dir[43275]: Please report any problems at http://mariadb.org/jira
Feb 06 09:25:16 localhost.localdomain mysql-prepare-db-dir[43275]: The latest information about MariaDB is available at http://mariadb.org/.
Feb 06 09:25:16 localhost.localdomain mysql-prepare-db-dir[43275]: You can find additional information about the MySQL part at:
Feb 06 09:25:16 localhost.localdomain mysql-prepare-db-dir[43275]: http://dev.mysql.com
Feb 06 09:25:16 localhost.localdomain mysql-prepare-db-dir[43275]: Support MariaDB development by buying support/new features from MariaDB
Feb 06 09:25:16 localhost.localdomain mysql-prepare-db-dir[43275]: Corporation Ab. You can contact us about this at sales@mariadb.com.
Feb 06 09:25:16 localhost.localdomain mysql-prepare-db-dir[43275]: Alternatively consider joining our community based development effort:
Feb 06 09:25:16 localhost.localdomain mysql-prepare-db-dir[43275]: http://mariadb.com/kb/en/contributing-to-the-mariadb-project/
Feb 06 09:25:16 localhost.localdomain mysqld[43433]: 2017-02-06  9:25:16 140101128218816 [Note] /usr/libexec/mysqld (mysqld 10.1.18-MariaD...433 ...
Feb 06 09:25:17 localhost.localdomain systemd[1]: Started MariaDB 10.1 database server.
Hint: Some lines were ellipsized, use -l to show in full.

MariaDB已经启动

初始化数据库

mysql_secure_installation

部署keystone

keystone关于数据库的操作

[root@localhost ~]# mysql -u root -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 8
Server version: 10.1.18-MariaDB MariaDB Server

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

Type help; or \h for help. Type \c to clear the current input statement.

MariaDB [(none)]> CREATE DATABASE keystone;#新建数据库
Query OK, 1 row affected (0.00 sec) 

MariaDB [(none)]> GRANT ALL PRIVILEGES ON keystone.* TO keystone@localhost     ->   IDENTIFIED BY 123;    #新建本地访问keystone账号
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> GRANT ALL PRIVILEGES ON keystone.* TO keystone@%     ->   IDENTIFIED BY 123;   #新建远程访问keystone账号
Query OK, 0 rows affected (0.00 sec)

安装包:

#keystone软件包名openstack-keystone
#安装httpd和mod_wsgi的原因是,社区主推apache+keystone
#openstack-keystone本质就是一款基于wsgi协议的web app,而httpd本质就是一个兼容wsgi协议的web server,所以我们需要为httpd安装mod_wsgi模块
yum -y install openstack-keystone httpd mod_wsgi

配置:/etc/keystone/keystone.conf

#让openstack-keystone能够知道如何连接到后端的数据库keystone
#mysql+pymysql:pymysql是一个python库,使用python可以操作mysql原生sql
[database]
connection = mysql+pymysql://keystone:123@192.168.31.57/keystone #注意123没有引号哈
[token]
provider = fernet #fernet为生成token的方式

初始化数据库keystone

#初始化是因为python的orm对象关系映射,需要初始化来生成数据库表结构
su -s /bin/sh -c "keystone-manage db_sync" keystone

 

第三:keystone操作

第四:验证

第五:创建脚本

第六:  总结

openstack 装逼之路~keystone部署

标签:ldap   mmu   sync   方式   png   plugins   ems   官方   ext   

原文地址:http://www.cnblogs.com/ylqh/p/6360148.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!