openstack【Kilo】入门 【准备篇】三:mysql(MariaDB)安装【控制节点】

问题导读

1.MariaDB与mysql的关系是什么?
2.遇到Checking for corrupt, not cleanly closed and upgrade needing tables.该如何解决?




安装mysql以前首先安装OpenStack 库
[Bash shell]  纯文本查看  复制代码
?
1
apt-get install ubuntu-cloud-keyring


[Bash shell]  纯文本查看  复制代码
?
1
2
   "trusty-updates/kilo main" > /etc/apt/sources .list.d /cloudarchive-kilo .list


[Bash shell]  纯文本查看  复制代码
?
1
apt-get update && apt-get dist-upgrade


若是不安装openstack库,直接安装keystone,会keystone可以安装成功,可是keystone启动后,接着就会失败。形成keystone为unknown instance


为何产生MariaDB
首先这里介绍一下,你们对MariaDB可能不太熟悉,MariaDB数据库管理系统是MySQL的一个分支,主要由开源社区在维护,采用GPL受权许可。开发这个分支的缘由之一是:甲骨文公司收购了MySQL后,有将MySQL闭源的潜在风险,所以社区采用分支的方式来避开这个风险。

根据官网文档:
安装
[Bash shell]  纯文本查看  复制代码
?
1
apt-get install mariadb-server python-mysqldb


修改配置文件


建立文件/etc/mysql/conf.d/mysqld_openstack.cnf完成下面内容:

a.在 [mysqld]部分,设置 bind-address 为控制节点管理网络ip地址,使能经过管理网络访问其它节点
[Bash shell]  纯文本查看  复制代码
?
1
2
3
[mysqld]
...
bind-address = 10.0.0.11



b.在 [mysqld] 部分,完成下面内容
[Bash shell]  纯文本查看  复制代码
?
1
2
3
4
5
6
7
[mysqld]
...
default-storage-engine = innodb
innodb_file_per_table
collation-server = utf8_general_ci
init-connect = 'SET NAMES utf8'
character- set -server = utf8



#######################################

下面是官网修改前内容,为废弃内容
/etc/mysql/my.cnf

找到bind-address           = 127.0.0.1
修改成下面:
[Bash shell]  纯文本查看  复制代码
?
1
2
3
[mysqld]
...
bind-address = 10.0.0.11



而后在新增以下内容:
[Bash shell]  纯文本查看  复制代码
?
1
2
3
4
5
6
7
[mysqld]
...
default-storage-engine = innodb
innodb_file_per_table
collation-server = utf8_general_ci
init-connect = 'SET NAMES utf8'
character- set -server = utf8


注意:不要带上[mysqld]

####################################################

重启mysql

[Bash shell]  纯文本查看  复制代码
?
1
service mysql restart


输出以下信息
* Stopping MariaDB database server mysqld                                                                                                    [ OK ] 
* Starting MariaDB database server mysqld                                                                                                    [ OK ] 
* Checking for corrupt, not cleanly closed and upgrade needing tables.




这个只是个提示,告诉你在作什么。无论它


新补充内容:
执行下面命令:
[Bash shell]  纯文本查看  复制代码
?
1
mysql_secure_installation


按照提示,设定便可



[Bash shell]  纯文本查看  复制代码
?
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28


# mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
       SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!
 
In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
 
Enter current password for root (enter for none):
OK, successfully used password, moving on...
 
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.
 
Set root password? [Y /n ] Y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
  ... Success!
 
 
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This isintended only for testing, and to make the installation