分享

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

pig2 发表于 2015-5-12 15:42:24 [显示全部楼层] 回帖奖励 阅读模式 关闭右栏 6 109045
本帖最后由 pig2 于 2015-8-14 15:01 编辑
问题导读

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




安装mysql之前首先安装OpenStack 库
[mw_shl_code=bash,true]apt-get install ubuntu-cloud-keyring[/mw_shl_code]

[mw_shl_code=bash,true]echo "deb http://ubuntu-cloud.archive.canonical.com/ubuntu" \
  "trusty-updates/kilo main" > /etc/apt/sources.list.d/cloudarchive-kilo.list[/mw_shl_code]

[mw_shl_code=bash,true]apt-get update && apt-get dist-upgrade[/mw_shl_code]

,如果不安装openstack库,直接安装keystone,会keystone能够安装成功,但是keystone启动后,接着就会失败。造成keystone为unknown instance


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

根据官网文档:
安装
[mw_shl_code=bash,true]apt-get install mariadb-server python-mysqldb[/mw_shl_code]

修改配置文件


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

a.在 [mysqld]部分,设置 bind-address 为控制节点管理网络ip地址,使能通过管理网络访问其它节点
[mw_shl_code=bash,true][mysqld]
...
bind-address = 10.0.0.11

[/mw_shl_code]


b.在 [mysqld] 部分,完成下面内容
[mw_shl_code=bash,true][mysqld]
...
default-storage-engine = innodb
innodb_file_per_table
collation-server = utf8_general_ci
init-connect = 'SET NAMES utf8'
character-set-server = utf8[/mw_shl_code]


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

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

找到bind-address           = 127.0.0.1
修改为下面:
[mw_shl_code=bash,true][mysqld]
...
bind-address = 10.0.0.11[/mw_shl_code]


然后在新增如下内容:
[mw_shl_code=bash,true][mysqld]
...
default-storage-engine = innodb
innodb_file_per_table
collation-server = utf8_general_ci
init-connect = 'SET NAMES utf8'
character-set-server = utf8[/mw_shl_code]

注意:不要带上[mysqld]


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

重启mysql

[mw_shl_code=bash,true]service mysql restart[/mw_shl_code]

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




这个只是个提示,告诉你在做什么。不管它


新补充内容:
执行下面命令:[mw_shl_code=bash,true]mysql_secure_installation[/mw_shl_code]

按照提示,设定即可



[mw_shl_code=bash,true]# 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 is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] Y
... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] Y
... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] Y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] Y
... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB![/mw_shl_code]



相关内容

openstack【Kilo】入门 【准备篇】零:整体介绍

openstack【Kilo】入门 【准备篇】一: Ubuntu14.04远程连接(ssh安装)

openstack【Kilo】入门 【准备篇】二:NTP安装

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

openstack【Kilo】入门 【准备篇】四:RabbitMQ 安装

openstack【Kilo】入门 【keystone篇】五:keystone安装与配置

openstack【Kilo】入门 【keystone篇】六:创建服务实例和 API endpoint

openstack【Kilo】入门 【keystone篇】七:创建租户、用户、角色

openstack【Kilo】入门 【keystone篇】八:验证keystone安装部署

openstack【Kilo】入门 【keystone篇】九: 创建openstack客户端环境变量脚本

openstack【Kilo】入门 【glance篇】十:glance安装配置【控制节点】

openstack【Kilo】入门 【glance篇】十一:glance安装验证

openstack【Kilo】入门 【nova篇】十二:安装配置nova

openstack【Kilo】入门 【网络篇】十三:安装配置【控制节点】

openstack【Kilo】入门 【网络篇】十四:安装配置【网络节点】

openstack【Kilo】入门 【网络篇】十五:安装配置【计算节点】

openstack【Kilo】入门 【网络篇】十六:实例化网络

openstack【Kilo】入门 【网络篇】十七:创建实例




已有(6)人评论

跳转到指定楼层
hyj8973 发表于 2015-10-29 17:26:51
修改完配置文件后,重启失败是什么情况。
新建的/etc/mysql/conf.d/mysqld_openstack.cnf 原先无该文件。
回复

使用道具 举报

pig2 发表于 2015-10-29 17:29:35
hyj8973 发表于 2015-10-29 17:26
修改完配置文件后,重启失败是什么情况。
新建的/etc/mysql/conf.d/mysqld_openstack.cnf 原先无该文件。

这个是自己创建的。
回复

使用道具 举报

oniji 发表于 2016-4-14 10:03:08
Failed to restart mysql.service: Unit mysql.service is masked.

重启失败,是不是因为mysqld_openstack.cnf这个文件没有配置对
回复

使用道具 举报

mnbvcmnmn 发表于 2016-4-27 16:57:47
mysqld_openstack.cnf这个文件到底是什么内容?写的不清楚啊,里面省略号是啥
回复

使用道具 举报

648423231 发表于 2017-6-7 16:05:16
配置完启动不了啊
回复

使用道具 举报

或许 发表于 2017-9-4 21:57:30
mnbvcmnmn 发表于 2016-4-27 16:57
mysqld_openstack.cnf这个文件到底是什么内容?写的不清楚啊,里面省略号是啥

同问,mysqld_openstack.cnf里的...是啥?写的一点都不详细。重启mysql服务的时候,会出现如下错误。root@Controller:/etc/mysql/conf.d# service mysql restart
* Stopping MariaDB database server mysqld                                                        error: Found option without preceding group in config file: /etc/mysql/conf.d/mysqld_openstack.cnf at line: 1
error: Found option without preceding group in config file: /etc/mysql/conf.d/mysqld_openstack.cnf at line: 1
                                                                                           [ OK ]
error: Found option without preceding group in config file: /etc/mysql/conf.d/mysqld_openstack.cnf at line: 1
* Starting MariaDB database server mysqld                                                        error: Found option without preceding group in config file: /etc/mysql/conf.d/mysqld_openstack.cnf at line: 1
error: Found option without preceding group in config file: /etc/mysql/conf.d/mysqld_openstack.cnf at line: 1
error: Found option without preceding group in config file: /etc/mysql/conf.d/mysqld_openstack.cnf at line: 1
error: Found option without preceding group in config file: /etc/mysql/conf.d/mysqld_openstack.cnf at line: 1
                                                                                           [ OK ]
* Checking for corrupt, not cleanly closed and upgrade needing tables.


回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

推荐上一条 /2 下一条