首页 > 代码库 > openstack 装逼之路~keystone部署
openstack 装逼之路~keystone部署
第一:版本信息
官网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 -aLinux 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=2logfile=/var/log/yum.logexactarch=1obsoletes=1gpgcheck=1plugins=1installonly_limit=5bugtracker_url=http://bugs.centos.org/set_project.php?project_id=23&ref=http://bugs.centos.org/bug_report_page.php?category=yumdistroverpkg=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 #本机管理网络ipdefault-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.serviceCreated 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=/usrFeb 06 09:25:16 localhost.localdomain mysql-prepare-db-dir[43275]: Please report any problems at http://mariadb.org/jiraFeb 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.comFeb 06 09:25:16 localhost.localdomain mysql-prepare-db-dir[43275]: Support MariaDB development by buying support/new features from MariaDBFeb 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 -pEnter password: Welcome to the MariaDB monitor. Commands end with ; or \g.Your MariaDB connection id is 8Server version: 10.1.18-MariaDB MariaDB ServerCopyright (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部署
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。