zoukankan      html  css  js  c++  java
  • Openstack的mysql数据多主galera的错误

    登录openstack的在dashboard,提示说权限验证错误,有2种情况: 1. 密码被人改了。 2. 系统发生了问题。

    密码确认没人改,所以查看/var/log/keystone-all.log日志,发现一堆错误:

    File "/usr/lib/python2.6/site-packages/keystone/assignment/core.py", line 262, in get_domain
        return self.driver.get_domain(domain_id)
      File "/usr/lib/python2.6/site-packages/keystone/assignment/backends/sql.py", line 526, in get_domain
        return self._get_domain(session, domain_id).to_dict()
      File "/usr/lib/python2.6/site-packages/keystone/assignment/backends/sql.py", line 519, in _get_domain
        ref = session.query(Domain).get(domain_id)
      File "/usr/lib64/python2.6/site-packages/sqlalchemy/orm/query.py", line 775, in get
        return self._load_on_ident(key)
      File "/usr/lib64/python2.6/site-packages/sqlalchemy/orm/query.py", line 2512, in _load_on_ident
        return q.one()
      File "/usr/lib64/python2.6/site-packages/sqlalchemy/orm/query.py", line 2184, in one
        ret = list(self)
      File "/usr/lib64/python2.6/site-packages/sqlalchemy/orm/query.py", line 2227, in __iter__
        return self._execute_and_instances(context)
      File "/usr/lib64/python2.6/site-packages/sqlalchemy/orm/query.py", line 2240, in _execute_and_instances
        close_with_result=True)
      File "/usr/lib64/python2.6/site-packages/sqlalchemy/orm/query.py", line 2231, in _connection_from_session
        **kw)
      File "/usr/lib64/python2.6/site-packages/sqlalchemy/orm/session.py", line 777, in connection
        close_with_result=close_with_result)
      File "/usr/lib64/python2.6/site-packages/sqlalchemy/orm/session.py", line 783, in _connection_for_bind
        return engine.contextual_connect(**kwargs)
      File "/usr/lib64/python2.6/site-packages/sqlalchemy/engine/base.py", line 2489, in contextual_connect
        self.pool.connect(),
      File "/usr/lib64/python2.6/site-packages/sqlalchemy/pool.py", line 236, in connect
        return _ConnectionFairy(self).checkout()
      File "/usr/lib64/python2.6/site-packages/sqlalchemy/pool.py", line 474, in checkout
        self)
      File "/usr/lib64/python2.6/site-packages/sqlalchemy/event.py", line 377, in __call__
        fn(*args, **kw)
      File "/usr/lib/python2.6/site-packages/keystone/common/sql/core.py", line 204, in mysql_on_checkout
        dbapi_conn.cursor().execute('select 1')
      File "/usr/lib64/python2.6/site-packages/MySQLdb/cursors.py", line 205, in execute
        self.errorhandler(self, exc, value)
      File "/usr/lib64/python2.6/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
        raise errorclass, errorvalue
    OperationalError: (1047, 'Unknown command')
    

    这里可以看出,是mysqldb引擎连接mysql进行数据操作mysql返回的错误,所以,基本判断是mysql出问题了,登录mysql,查询admin的密码,发现连mysql的use命令都无法使用。所以引出了mysql的galera的问题。

    mysql的galera是一种多主的mysql的HA方案,由单独开发一段程序在mysql底层实现数据的复制,而在各个服务器操作mysql上基本和单机没有区别。 但是在线上没有做任何修改,一直运行的过程中,发生了一个错误:

    [root@node-10 conf.d]# mysql
    Welcome to the MySQL monitor.  Commands end with ; or g.
    Your MySQL connection id is 30631
    Server version: 5.5.28
    
    Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
    
    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.
    
    Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
    
    mysql> use keystone;
    ERROR 1047 (08S01): Unknown command
    

    我们应该知道mysql的use命令肯定是存在的。如果我们真实输入一个不存在的命令,提示也应该是这样的:

    Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
    
    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.
    
    Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
    
    mysql> test
        -> ;
    ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'test' at line 1
    

    这里先初步解决,让服务器运行起来,重启服务即可

    service mysql restart
    

    注意,这里/etc/init.d/mysql这个文件是使用了galera的定制化的脚本,理论上是将集群中所有的mysql服务重启,如果失败,可以手动kill -9即可。

    然后再登录openstack的HA环境,就可以成功了。

  • 相关阅读:
    小程序中template的用法
    小程序弹窗的几种形式
    js怎样截取以'-'分割的字符串
    js怎样截取字符串后几位以及截取字符串前几位
    局域网聊天软件项目小结(1)
    IPAddress类
    Combobox 成员添加
    tcpclient 类
    console.read()读入的内容
    技术带来的进步与退步---一点点反思
  • 原文地址:https://www.cnblogs.com/CLTANG/p/4332564.html
Copyright © 2011-2022 走看看