当前位置:   article > 正文

trove mysql 镜像_Linux运维----03.制作trove-mysql5.7镜像

trove镜像制作

安装mysql

yum install http://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm

yum remove mariadb-libs

yum install mysql-community-server

2.配置mysql

mkdir -p /etc/mysql/conf.d/

vim /etc/my.cnf

.....

#此处有空行

!includedir /etc/mysql/conf.d/

chown -R mysql:mysql /etc/mysql/

3.安装percona-xtrabackup

innobackupex

yum install https://www.percona.com/redir/downloads/percona-release/redhat/percona-release-0.1-4.noarch.rpm

yum install percona-xtrabackup-24

出现如下问题:

Transaction check error:

file /etc/my.cnf from install of Percona-Server-shared-56-5.6.44-rel86.0.el7.x86_64 conflicts with file from package mysql-community-server-5.7.26-1.el7.x86_64

Error Summary

-------------

方案:

yum install mysql-community-libs-compat

4.源码安装trove-guestagnet

yum install -y epel-release

yum install -y python2-pip gcc git

useradd -m trove

cat /etc/sudoers.d/trove

Defaults:trove !requiretty

trove ALL=(ALL) NOPASSWD:ALL

# 源码已下载

cd /home/trove/trove

git checkcout stable/pike

pip install -r requirements.txt

python setup.py install

bug:

#include "Python.h"

^

compilation terminated.

error: command 'gcc' failed with exit status 1

yum install pyhton-devel

python setup.py install

5.创建启动文件

mkdir -p /etc/trove/conf.d

chown -R trove:trove /etc/trove

mkdir -p /var/lib/trove

chown -R trove:trove /var/lib/trove

mkdir -p /var/log/trove

chown -R trove:trove /var/log/trove

touch /etc/trove/conf.d/trove-guestagent.conf

touch /etc/trove/conf.d/guest_info.conf

vim /etc/trove/conf.d/guest_info.conf

[DEFAULT]

guest_id = none

chown -R trove:trove /etc/trove

cat /usr/lib/systemd/system/trove-guestagent.service

[Unit]

Description=OpenStack Trove guestagent Service

After=syslog.target network.target

[Service]

Type=simple

User=trove

ExecStart=/usr/bin/trove-guestagent --config-file /etc/trove/conf.d/trove-guestagent.conf --config-file /etc/trove/conf.d/guest_info.conf

Restart=on-failure

[Install]

WantedBy=multi-user.target

[Unit]

Description=OpenStack Trove guestagent Service

After=syslog.target network.target

[Service]

Type=simple

User=trove

ExecStart=/usr/bin/trove-guestagent --config-file /etc/trove/conf.d/trove-guestagent.conf --config-file /etc/trove/conf.d/guest_info.conf

Restart=on-failure

[Install]

WantedBy=multi-user.target

systemctl daemon-reload

systemctl enable trove-guestagent.service

7.创建mysql拷贝文件,加入开机启动

vim /root/mysql.sh

mysql_cnf="/home/trove/.my.cnf"

function mv_mysql_cnf(){

while ((1==1))

do

if [[ -f $mysql_cnf ]]

then

cp $mysql_cnf /root/

break

fi

done

}

mv_mysql_cnf

chmod +x /root/mysql.sh

vim /etc/rc.d/rc.local

/root/mysql.sh &

chmod +x /etc/rc.d/rc.local

8.验证

trove-manage --config-file /etc/trove/trove.conf datastore_version_update mysql mysql-5.7 mysql 3aea56f7-8451-451d-b4b1-8f9e87a1f8b6 '' 1

trove create ab_57 2 --size 5 --databases myDB --users tulong:tulong@123 --datastore_version mysql-5.7 --datastore mysql --nic net-id=ab9c9463-ea02-4b60-b559-1857e5ebfc13

trove list

trove user-list

trove creat-user zhangsan zhansan@123

trove user-list

9.bug

1. /var/log/trove-geustagent.log

2019-05-29 17:17:51.380 840 DEBUG oslo_concurrency.processutils [-] CMD "sudo cat /root/.mysql_secret" returned: 1 in 0.042s execute /usr/lib/python2.7/site-packages/oslo_concurrency/processutils.py:409

2019-05-29 17:17:51.381 840 DEBUG oslo_concurrency.processutils [-] u'sudo cat /root/.mysql_secret' failed. Not Retrying. execute /usr/lib/python2.7/site-packages/oslo_concurrency/processutils.py:457

2019-05-29 17:17:51.381 840 ERROR trove.guestagent.datastore.mysql_common.service [-] /root/.mysql_secret does not exist.: ProcessExecutionError: Unexpected error while running command.

Command: sudo cat /root/.mysql_secret

Exit code: 1

Stdout: u''

Stderr: u'cat: /root/.mysql_secret: No such file or directory\n'

2019-05-29 17:17:51.381 840 ERROR trove.guestagent.datastore.mysql_common.service Traceback (most recent call last):

2019-05-29 17:17:51.381 840 ERROR trove.guestagent.datastore.mysql_common.service File "/usr/lib/python2.7/site-packages/trove/guestagent/datastore/mysql_common/service.py", line 96, in clear_expired_password

2019-05-29 17:17:51.381 840 ERROR trove.guestagent.datastore.mysql_common.service run_as_root=True, root_helper="sudo")

2019-05-29 17:17:51.381 840 ERROR trove.guestagent.datastore.mysql_common.service File "/usr/lib/python2.7/site-packages/oslo_concurrency/processutils.py", line 424, in execute

2019-05-29 17:17:51.381 840 ERROR trove.guestagent.datastore.mysql_common.service cmd=sanitized_cmd)

2019-05-29 17:17:51.381 840 ERROR trove.guestagent.datastore.mysql_common.service ProcessExecutionError: Unexpected error while running command.

2019-05-29 17:17:51.381 840 ERROR trove.guestagent.datastore.mysql_common.service Command: sudo cat /root/.mysql_secret

2019-05-29 17:17:51.381 840 ERROR trove.guestagent.datastore.mysql_common.service Exit code: 1

2019-05-29 17:17:51.381 840 ERROR trove.guestagent.datastore.mysql_common.service Stdout: u''

2019-05-29 17:17:51.381 840 ERROR trove.guestagent.datastore.mysql_common.service Stderr: u'cat: /root/.mysql_secret: No such file or directory\n'

2019-05-29 17:17:51.381 840 ERROR trove.guestagent.datastore.mysql_common.service

2019-05-29 17:17:51.382 840 DEBUG trove.guestagent.datastore.mysql_common.service [-] Generating admin password. secure /usr/lib/python2.7/site-packages/trove/guestagent/datastore/mysql_common/service.py:696

2019-05-29 17:17:51.586 840 ERROR trove.guestagent.datastore.manager [-] An error occurred preparing datastore: (pymysql.err.OperationalError) (1045, u"Access denied for user 'root'@'localhost' (using password: NO)")

(Background on this error at: http://sqlalche.me/e/e3q8): OperationalError: (pymysql.err.OperationalError) (1045, u"Access denied for user 'root'@'localhost' (using password: NO)")

(Background on this error at: http://sqlalche.me/e/e3q8)

2019-05-29 17:17:51.586 840 ERROR trove.guestagent.datastore.manager Traceback (most recent call last):

2019-05-29 17:17:51.586 840 ERROR trove.guestagent.datastore.manager File "/usr/lib/python2.7/site-packages/trove/guestagent/datastore/manager.py", line 285, in _prepare

2019-05-29 17:17:51.586 840 ERROR trove.guestagent.datastore.manager cluster_config, snapshot)

2019-05-29 17:17:51.586 840 ERROR trove.guestagent.datastore.manager File "/usr/lib/python2.7/site-packages/osprofiler/profiler.py", line 160, in wrapper

2019-05-29 17:17:51.586 840 ERROR trove.guestagent.datastore.manager result = f(*args, **kwargs)

2019-05-29 17:17:51.586 840 ERROR trove.guestagent.datastore.manager File "/usr/lib/python2.7/site-packages/trove/guestagent/datastore/mysql_common/manager.py", line 233, in do_prepare

2019-05-29 17:17:51.586 840 ERROR trove.guestagent.datastore.manager app.secure(config_contents)

2019-05-29 17:17:51.586 840 ERROR trove.guestagent.datastore.manager File "/usr/lib/python2.7/site-packages/trove/guestagent/datastore/mysql_common/service.py", line 700, in secure

2019-05-29 17:17:51.586 840 ERROR trove.guestagent.datastore.manager with self.local_sql_client(engine, use_flush=False) as client:

2019-05-29 17:17:51.586 840 ERROR trove.guestagent.datastore.manager File "/usr/lib/python2.7/site-packages/trove/guestagent/datastore/mysql_common/service.py", line 186, in __enter__

2019-05-29 17:17:51.586 840 ERROR trove.guestagent.datastore.manager self.conn = self.engine.connect()

2019-05-29 17:17:51.586 840 ERROR trove.guestagent.datastore.manager File "/usr/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 2193, in connect

2019-05-29 17:17:51.586 840 ERROR trove.guestagent.datastore.manager return self._connection_cls(self, **kwargs)

2019-05-29 17:17:51.586 840 ERROR trove.guestagent.datastore.manager File "/usr/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 103, in __init__

2019-05-29 17:17:51.586 840 ERROR trove.guestagent.datastore.manager else engine.raw_connection()

2019-05-29 17:17:51.586 840 ERROR trove.guestagent.datastore.manager File "/usr/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 2293, in raw_connection

2019-05-29 17:17:51.586 840 ERROR trove.guestagent.datastore.manager self.pool.unique_connection, _connection

2019-05-29 17:17:51.586 840 ERROR trove.guestagent.datastore.manager File "/usr/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 2266, in _wrap_pool_connect

2019-05-29 17:17:51.586 840 ERROR trove.guestagent.datastore.manager e, dialect, self

2019-05-29 17:17:51.586 840 ERROR trove.guestagent.datastore.manager File "/usr/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1536, in _handle_dbapi_exception_noconnection

2019-05-29 17:17:51.586 840 ERROR trove.guestagent.datastore.manager util.raise_from_cause(sqlalchemy_exception, exc_info)

2019-05-29 17:17:51.586 840 ERROR trove.guestagent.datastore.manager File "/usr/lib/python2.7/site-packages/sqlalchemy/util/compat.py", line 383, in raise_from_cause

2019-05-29 17:17:51.586 840 ERROR trove.guestagent.datastore.manager reraise(type(exception), exception, tb=exc_tb, cause=cause)

2019-05-29 17:17:51.586 840 ERROR trove.guestagent.datastore.manager File "/usr/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 2262, in _wrap_pool_connect

2019-05-29 17:17:51.586 840 ERROR trove.guestagent.datastore.manager return fn()

2019-05-29 17:17:51.586 840 ERROR trove.guestagent.datastore.manager File "/usr/lib/python2.7/site-packages/sqlalchemy/pool/base.py", line 303, in unique_connection

2019-05-29 17:17:51.586 840 ERROR trove.guestagent.datastore.manager return _ConnectionFairy._checkout(self)

2019-05-29 17:17:51.586 840 ERROR trove.guestagent.datastore.manager File "/usr/lib/python2.7/site-packages/sqlalchemy/pool/base.py", line 760, in _checkout

2019-05-29 17:17:51.586 840 ERROR trove.guestagent.datastore.manager fairy = _ConnectionRecord.checkout(pool)

2019-05-29 17:17:51.586 840 ERROR trove.guestagent.datastore.manager File "/usr/lib/python2.7/site-packages/sqlalchemy/pool/base.py", line 492, in checkout

2019-05-29 17:17:51.586 840 ERROR trove.guestagent.datastore.manager rec = pool._do_get()

2019-05-29 17:17:51.586 840 ERROR trove.guestagent.datastore.manager File "/usr/lib/python2.7/site-packages/sqlalchemy/pool/impl.py", line 139, in _do_get

2019-05-29 17:17:51.586 840 ERROR trove.guestagent.datastore.manager self._dec_overflow()

2019-05-29 17:17:51.586 840 ERROR trove.guestagent.datastore.manager File "/usr/lib/python2.7/site-packages/sqlalchemy/util/langhelpers.py", line 68, in __exit__

2019-05-29 17:17:51.586 840 ERROR trove.guestagent.datastore.manager compat.reraise(exc_type, exc_value, exc_tb)

2019-05-29 17:17:51.586 840 ERROR trove.guestagent.datastore.manager File "/usr/lib/python2.7/site-packages/sqlalchemy/pool/impl.py", line 136, in _do_get

2019-05-29 17:17:51.586 840 ERROR trove.guestagent.datastore.manager return self._create_connection()

2019-05-29 17:17:51.586 840 ERROR trove.guestagent.datastore.manager File "/usr/lib/python2.7/site-packages/sqlalchemy/pool/base.py", line 308, in _create_connection

2019-05-29 17:17:51.586 840 ERROR trove.guestagent.datastore.manager return _ConnectionRecord(self)

2019-05-29 17:17:51.586 840 ERROR trove.guestagent.datastore.manager File "/usr/lib/python2.7/site-packages/sqlalchemy/pool/base.py", line 437, in __init__

2019-05-29 17:17:51.586 840 ERROR trove.guestagent.datastore.manager self.__connect(first_connect_check=True)

2019-05-29 17:17:51.586 840 ERROR trove.guestagent.datastore.manager File "/usr/lib/python2.7/site-packages/sqlalchemy/pool/base.py", line 639, in __connect

2019-05-29 17:17:51.586 840 ERROR trove.guestagent.datastore.manager connection = pool._invoke_creator(self)

2019-05-29 17:17:51.586 840 ERROR trove.guestagent.datastore.manager File "/usr/lib/python2.7/site-packages/sqlalchemy/engine/strategies.py", line 114, in connect

2019-05-29 17:17:51.586 840 ERROR trove.guestagent.datastore.manager return dialect.connect(*cargs, **cparams)

2019-05-29 17:17:51.586 840 ERROR trove.guestagent.datastore.manager File "/usr/lib/python2.7/site-packages/sqlalchemy/engine/default.py", line 451, in connect

2019-05-29 17:17:51.586 840 ERROR trove.guestagent.datastore.manager return self.dbapi.connect(*cargs, **cparams)

2019-05-29 17:17:51.586 840 ERROR trove.guestagent.datastore.manager File "/usr/lib/python2.7/site-packages/pymysql/__init__.py", line 94, in Connect

2019-05-29 17:17:51.586 840 ERROR trove.guestagent.datastore.manager return Connection(*args, **kwargs)

2019-05-29 17:17:51.586 840 ERROR trove.guestagent.datastore.manager File "/usr/lib/python2.7/site-packages/pymysql/connections.py", line 325, in __init__

2019-05-29 17:17:51.586 840 ERROR trove.guestagent.datastore.manager self.connect()

2019-05-29 17:17:51.586 840 ERROR trove.guestagent.datastore.manager File "/usr/lib/python2.7/site-packages/pymysql/connections.py", line 599, in connect

2019-05-29 17:17:51.586 840 ERROR trove.guestagent.datastore.manager self._request_authentication()

2019-05-29 17:17:51.586 840 ERROR trove.guestagent.datastore.manager File "/usr/lib/python2.7/site-packages/pymysql/connections.py", line 861, in _request_authentication

2019-05-29 17:17:51.586 840 ERROR trove.guestagent.datastore.manager auth_packet = self._read_packet()

2019-05-29 17:17:51.586 840 ERROR trove.guestagent.datastore.manager File "/usr/lib/python2.7/site-packages/pymysql/connections.py", line 684, in _read_packet

2019-05-29 17:17:51.586 840 ERROR trove.guestagent.datastore.manager packet.check_error()

2019-05-29 17:17:51.586 840 ERROR trove.guestagent.datastore.manager File "/usr/lib/python2.7/site-packages/pymysql/protocol.py", line 220, in check_error

2019-05-29 17:17:51.586 840 ERROR trove.guestagent.datastore.manager err.raise_mysql_exception(self._data)

2019-05-29 17:17:51.586 840 ERROR trove.guestagent.datastore.manager File "/usr/lib/python2.7/site-packages/pymysql/err.py", line 109, in raise_mysql_exception

2019-05-29 17:17:51.586 840 ERROR trove.guestagent.datastore.manager raise errorclass(errno, errval)

2019-05-29 17:17:51.586 840 ERROR trove.guestagent.datastore.manager OperationalError: (pymysql.err.OperationalError) (1045, u"Access denied for user 'root'@'localhost' (using password: NO)")

2019-05-29 17:17:51.586 840 ERROR trove.guestagent.datastore.manager (Background on this error at: http://sqlalche.me/e/e3q8)

2019-05-29 17:17:51.586 840 ERROR trove.guestagent.datastore.manager

2019-05-29 17:17:51.727 840 INFO trove.guestagent.datastore.manager [-] Ending datastore prepare for 'mysql'.

2019-05-29 17:17:51.727 840 INFO trove.guestagent.datastore.service [-] Set final status to failed to spawn.

2019-05-29 17:17:51.728 840 DEBUG trove.guestagent.datastore.service [-] Casting set_status message to conductor (status is 'failed to spawn'). set_status /usr/lib/python2.7/site-packages/trove/guestagent/datastore/service.py:166

2019-05-29 17:17:51.730 840 DEBUG trove.conductor.api [-] Making async call to cast heartbeat for instance: 0d2b580c-6ad6-496b-b7e3-fe20bde31ec3 heartbeat /usr/lib/python2.7/site-packages/trove/conductor/api.py:73

2019-05-29 17:17:51.740 840 DEBUG trove.guestagent.datastore.service [-] Successfully cast set_status. set_status /usr/lib/python2.7/site-packages/trove/guestagent/datastore/service.py:173

2019-05-29 17:17:51.742 840 DEBUG trove.conductor.api [-] Making async call to cast error notification notify_exc_info /usr/lib/python2.7/site-packages/trove/conductor/api.py:116

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server [-] Exception during message handling: OperationalError: (pymysql.err.OperationalError) (1045, u"Access denied for user 'root'@'localhost' (using password: NO)")

(Background on this error at: http://sqlalche.me/e/e3q8)

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server Traceback (most recent call last):

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server File "/usr/lib/python2.7/site-packages/oslo_messaging/rpc/server.py", line 165, in _process_incoming

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server res = self.dispatcher.dispatch(message)

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server File "/usr/lib/python2.7/site-packages/oslo_messaging/rpc/dispatcher.py", line 274, in dispatch

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server return self._do_dispatch(endpoint, method, ctxt, args)

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server File "/usr/lib/python2.7/site-packages/oslo_messaging/rpc/dispatcher.py", line 194, in _do_dispatch

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server result = func(ctxt, **new_args)

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server File "/usr/lib/python2.7/site-packages/osprofiler/profiler.py", line 160, in wrapper

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server result = f(*args, **kwargs)

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server File "/usr/lib/python2.7/site-packages/trove/guestagent/datastore/manager.py", line 270, in prepare

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server cluster_config, snapshot, modules)

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server File "/usr/lib/python2.7/site-packages/trove/guestagent/datastore/manager.py", line 285, in _prepare

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server cluster_config, snapshot)

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server File "/usr/lib/python2.7/site-packages/osprofiler/profiler.py", line 160, in wrapper

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server result = f(*args, **kwargs)

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server File "/usr/lib/python2.7/site-packages/trove/guestagent/datastore/mysql_common/manager.py", line 233, in do_prepare

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server app.secure(config_contents)

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server File "/usr/lib/python2.7/site-packages/trove/guestagent/datastore/mysql_common/service.py", line 700, in secure

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server with self.local_sql_client(engine, use_flush=False) as client:

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server File "/usr/lib/python2.7/site-packages/trove/guestagent/datastore/mysql_common/service.py", line 186, in __enter__

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server self.conn = self.engine.connect()

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server File "/usr/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 2193, in connect

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server return self._connection_cls(self, **kwargs)

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server File "/usr/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 103, in __init__

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server else engine.raw_connection()

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server File "/usr/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 2293, in raw_connection

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server self.pool.unique_connection, _connection

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server File "/usr/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 2266, in _wrap_pool_connect

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server e, dialect, self

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server File "/usr/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1536, in _handle_dbapi_exception_noconnection

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server util.raise_from_cause(sqlalchemy_exception, exc_info)

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server File "/usr/lib/python2.7/site-packages/sqlalchemy/util/compat.py", line 383, in raise_from_cause

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server reraise(type(exception), exception, tb=exc_tb, cause=cause)

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server File "/usr/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 2262, in _wrap_pool_connect

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server return fn()

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server File "/usr/lib/python2.7/site-packages/sqlalchemy/pool/base.py", line 303, in unique_connection

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server return _ConnectionFairy._checkout(self)

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server File "/usr/lib/python2.7/site-packages/sqlalchemy/pool/base.py", line 760, in _checkout

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server fairy = _ConnectionRecord.checkout(pool)

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server File "/usr/lib/python2.7/site-packages/sqlalchemy/pool/base.py", line 492, in checkout

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server rec = pool._do_get()

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server File "/usr/lib/python2.7/site-packages/sqlalchemy/pool/impl.py", line 139, in _do_get

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server self._dec_overflow()

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server File "/usr/lib/python2.7/site-packages/sqlalchemy/util/langhelpers.py", line 68, in __exit__

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server compat.reraise(exc_type, exc_value, exc_tb)

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server File "/usr/lib/python2.7/site-packages/sqlalchemy/pool/impl.py", line 136, in _do_get

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server return self._create_connection()

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server File "/usr/lib/python2.7/site-packages/sqlalchemy/pool/base.py", line 308, in _create_connection

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server return _ConnectionRecord(self)

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server File "/usr/lib/python2.7/site-packages/sqlalchemy/pool/base.py", line 437, in __init__

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server self.__connect(first_connect_check=True)

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server File "/usr/lib/python2.7/site-packages/sqlalchemy/pool/base.py", line 639, in __connect

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server connection = pool._invoke_creator(self)

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server File "/usr/lib/python2.7/site-packages/sqlalchemy/engine/strategies.py", line 114, in connect

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server return dialect.connect(*cargs, **cparams)

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server File "/usr/lib/python2.7/site-packages/sqlalchemy/engine/default.py", line 451, in connect

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server return self.dbapi.connect(*cargs, **cparams)

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server File "/usr/lib/python2.7/site-packages/pymysql/__init__.py", line 94, in Connect

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server return Connection(*args, **kwargs)

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server File "/usr/lib/python2.7/site-packages/pymysql/connections.py", line 325, in __init__

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server self.connect()

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server File "/usr/lib/python2.7/site-packages/pymysql/connections.py", line 599, in connect

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server self._request_authentication()

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server File "/usr/lib/python2.7/site-packages/pymysql/connections.py", line 861, in _request_authentication

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server auth_packet = self._read_packet()

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server File "/usr/lib/python2.7/site-packages/pymysql/connections.py", line 684, in _read_packet

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server packet.check_error()

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server File "/usr/lib/python2.7/site-packages/pymysql/protocol.py", line 220, in check_error

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server err.raise_mysql_exception(self._data)

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server File "/usr/lib/python2.7/site-packages/pymysql/err.py", line 109, in raise_mysql_exception

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server raise errorclass(errno, errval)

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server OperationalError: (pymysql.err.OperationalError) (1045, u"Access denied for user 'root'@'localhost' (using password: NO)")

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server (Background on this error at: http://sqlalche.me/e/e3q8)

2019-05-29 17:17:51.755 840 ERROR oslo_messaging.rpc.server

touch /root/.secert

chmod 755 /root/.secret

#2.修复上述bu,重新创建实例:

vim /var/log/trove-guestagent.log

_concurrency/processutils.py:409

2019-05-29 18:10:12.733 842 DEBUG oslo_concurrency.processutils [-] u'sudo systemctl start mysqld' failed. Not Retrying. execute /usr/lib/python2.7/site-packages/oslo_concurrency/processutils.py:457

2019-05-29 18:10:12.734 842 DEBUG oslo_concurrency.processutils [-] Running cmd (subprocess): sudo /usr/bin/mysqladmin ping execute /usr/lib/python2.7/site-packages/oslo_concurrency/processutils.py:372

2019-05-29 18:10:12.908 842 DEBUG oslo_concurrency.processutils [-] CMD "sudo /usr/bin/mysqladmin ping" returned: 1 in 0.174s execute /usr/lib/python2.7/site-packages/oslo_concurrency/processutils.py:409

2019-05-29 18:10:12.908 842 DEBUG oslo_concurrency.processutils [-] u'sudo /usr/bin/mysqladmin ping' failed. Not Retrying. execute /usr/lib/python2.7/site-packages/oslo_concurrency/processutils.py:457

2019-05-29 18:10:12.909 842 ERROR trove.common.utils [-] Command 'sudo /usr/bin/mysqladmin ping' failed. Exit code: 1

stderr: ^Gmysqladmin: connect to server at 'localhost' failed

error: 'Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)'

Check that mysqld is running and that the socket: '/var/lib/mysql/mysql.sock' exists!

stdout: : ProcessExecutionError: Unexpected error while running command.

2019-05-29 18:10:12.910 842 ERROR trove.guestagent.datastore.mysql_common.service [-] Failed to get database status.: ProcessExecutionError: Unexpected error while running command.

Command: sudo /usr/bin/mysqladmin ping

Exit code: 1

Stdout: u''

Stderr: u"\x07mysqladmin: connect to server at 'localhost' failed\nerror: 'Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)'\nCheck that mysqld is running and that the socket: '/var/lib/mysql/mysql.sock' exists!\n"

可以查看到mysql服务进程没有正常启动

vim /var/log/mysqld.log

2019-05-29T10:09:53.576866Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.26) starting as process 2463 ...

2019-05-29T10:09:53.608137Z 0 [Note] InnoDB: PUNCH HOLE support available

2019-05-29T10:09:53.608195Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins

2019-05-29T10:09:53.608202Z 0 [Note] InnoDB: Uses event mutexes

2019-05-29T10:09:53.608205Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier

2019-05-29T10:09:53.608208Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11

2019-05-29T10:09:53.608214Z 0 [Note] InnoDB: Using Linux native AIO

2019-05-29T10:09:53.608818Z 0 [Note] InnoDB: Number of pools: 1

2019-05-29T10:09:53.609073Z 0 [Note] InnoDB: Using CPU crc32 instructions

2019-05-29T10:09:53.613009Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M

2019-05-29T10:09:53.656199Z 0 [Note] InnoDB: Completed initialization of buffer pool

2019-05-29T10:09:53.685704Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().

2019-05-29T10:09:53.697395Z 0 [Note] InnoDB: The first innodb_system data file 'ibdata1' did not exist. A new tablespace will be created!

2019-05-29T10:09:53.697720Z 0 [Note] InnoDB: Setting file './ibdata1' size to 12 MB. Physically writing the file full; Please wait ...

2019-05-29T10:09:54.659961Z 0 [Note] InnoDB: File './ibdata1' size is now 12 MB.

2019-05-29T10:09:54.660616Z 0 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB

2019-05-29T10:09:56.267639Z 0 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB

2019-05-29T10:09:57.808737Z 0 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0

2019-05-29T10:09:57.808847Z 0 [Warning] InnoDB: New log files created, LSN=45790

2019-05-29T10:09:57.808872Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables

2019-05-29T10:09:57.808924Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...

2019-05-29T10:09:58.190716Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.

2019-05-29T10:09:58.190993Z 0 [Note] InnoDB: Doublewrite buffer not found: creating new

2019-05-29T10:09:58.433915Z 0 [Note] InnoDB: Doublewrite buffer created

2019-05-29T10:09:58.442027Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.

2019-05-29T10:09:58.442049Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.

2019-05-29T10:09:58.442229Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.

2019-05-29T10:09:58.521762Z 0 [Note] InnoDB: Foreign key constraint system tables created

2019-05-29T10:09:58.521877Z 0 [Note] InnoDB: Creating tablespace and datafile system tables.

2019-05-29T10:09:58.542715Z 0 [Note] InnoDB: Tablespace and datafile system tables created.

2019-05-29T10:09:58.542801Z 0 [Note] InnoDB: Creating sys_virtual system tables.

2019-05-29T10:09:58.564689Z 0 [Note] InnoDB: sys_virtual table created

2019-05-29T10:09:58.566609Z 0 [Note] InnoDB: Waiting for purge to start

2019-05-29T10:09:58.616728Z 0 [Note] InnoDB: 5.7.26 started; log sequence number 0

2019-05-29T10:09:58.617297Z 0 [Note] Plugin 'FEDERATED' is disabled.

mysqld: Table 'mysql.plugin' doesn't exist

2019-05-29T10:09:58.617565Z 0 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.

vim /etc/my.cnf

explicit_defaults_for_timestamp=true

备注:mysql5.5、mysql5.6部署完毕后root密码为空,因此trove-guest-agent初始化的代码逻辑是默认mysql的root密码是空的,但是mysql5.7部署完毕后root密码是随机的,所以我们需要重新将root密码为空。mysql5.7默认安装validate_password plugin,导致trove所有创建或者修改密码的字符串都要严格遵循密码安全等级,需要卸载。

mysql 5.7安装完成,在/var/log/mysqld.log 中会生成临时密码,如果有多个,最后一个起作用。

/var/log/mysqld.log

2019-05-29T10:34:10.064386Z 1 [Note] A temporary password is generated for root@localhost: 8-hy:kMH*uS5

temporary_password=$(grep 'root@localhost' $log_file | tail -1 | awk -F 'root@localhost: ' '{print $NF}')

mysql -uroot -p$temporary_password -e "set password=password('my new password');uninstall plugin validate_password;set password=password('');flush privileges;"

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小小林熬夜学编程/article/detail/88549
推荐阅读
相关标签
  

闽ICP备14008679号