정보공유

How to Rocks cluster database (mysql) access

CheekyKite 2017. 4. 13.

How to Rocks cluster database (mysql) access / 2017-04-13 / Dasandata.co.ltd

도움이된 사이트 - [Rocks-Discuss] Duplicated host name




안녕하세요.

다산데이타 입니다.


Rocks Cluster 에 compute node를 추가 작업을 하던중 어떠한 이유로 host name 이 중복등록 되어

삭제 (rocks remove)를 시도하니  MySQLdb Error 가 발생하였습니다.


Rocks Cluster 의 MySQLdb에 직접 접근한 후

해당 node를 삭제 (delete) 하여 문제를 해결 하였습니다.


Rocks Cluster 버젼에 따라 mysql 의 실행 경로가 약간 다른점을 유의하시기 바랍니다.


감사합니다.


====== Rocks Cluster MySQLdb Error for Duplicated host name =========================


[root@dasandata ~]#

[root@dasandata ~]#

[root@dasandata ~]# rocks remove host compute-1-0

Traceback (most recent call last):

 File "/opt/rocks/bin/rocks", line 300, in <module>

 command.runWrapper(name, args[i:])

 File "/opt/rocks/lib/python2.6/site-packages/rocks/commands/__init__.py", line 2213, in runWrapper

 self.run(self._params, self._args)

 File "/opt/rocks/lib/python2.6/site-packages/rocks/commands/remove/host/__init__.py", line 118, in run

 self.runPlugins(host)

 File "/opt/rocks/lib/python2.6/site-packages/rocks/commands/__init__.py", line 1956, in runPlugins

 plugin.run(args)

 File "/opt/rocks/lib/python2.6/site-packages/rocks/commands/remove/host/plugin_boot.py", line 103, in run

 self.owner.command('remove.host.boot', [ host ])

 File "/opt/rocks/lib/python2.6/site-packages/rocks/commands/__init__.py", line 1891, in command

 o.runWrapper(name, args)

 File "/opt/rocks/lib/python2.6/site-packages/rocks/commands/__init__.py", line 2213, in runWrapper

 self.run(self._params, self._args)

 File "/opt/rocks/lib/python2.6/site-packages/rocks/commands/remove/host/boot/__init__.py", line 110, in run

 host)

 File "/opt/rocks/lib/python2.6/site-packages/rocks/commands/__init__.py", line 1256, in execute

 return self.link.execute(command)

 File "/opt/rocks/lib/python2.6/site-packages/MySQLdb/cursors.py", line 174, in execute

 self.errorhandler(self, exc, value)

 File "/opt/rocks/lib/python2.6/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler

 raise errorclass, errorvalue

_mysql_exceptions.OperationalError: (1242, 'Subquery returns more than 1 row')

[root@dasandata ~]#

[root@dasandata:~]#

[root@dasandata:~]#

[root@dasandata:~]#


===== Rocks 6.1 (CentOS 6.5) ==============================================


[root@dasandata ~]#

[root@dasandata ~]# uname -a
Linux dasandata 2.6.32-431.11.2.el6.x86_64 #1 SMP Tue Mar 25 19:59:55 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
[root@dasandata ~]#
[root@dasandata ~]# cat /etc/*release
CentOS release 6.5 (Final)
Rocks release 6.1.1 (Sand Boa)
[root@dasandata ~]#
[root@dasandata ~]#
[root@dasandata ~]# /opt/rocks/bin/mysql --defaults-extra-file=/root/.rocks.my.cnf --user=root cluster
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1662
Server version: 5.1.56 Source distribution

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

===== Rocks 6.2 (CentOS 6.6 or 6.8) ===========================================


[root@dasandata:~]#
[root@dasandata:~]# uname -a
Linux dasandata.dasandata 2.6.32-642.6.1.el6.x86_64 #1 SMP Wed Oct 5 00:36:12 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
[root@dasandata:~]#
[root@dasandata:~]#
[root@dasandata:~]# cat /etc/*release
CentOS release 6.8 (Final)
Rocks release 6.2 (SideWinder)
[root@dasandata:~]#
[root@dasandata:~]#

[root@dasandata:~]# /opt/rocks/mysql/bin/mysql --defaults-extra-file=/root/.rocks.my.cnf --user=root cluster

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with -A


Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 415

Server version: 5.6.15 Source distribution


Copyright (c) 2000, 2013, 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.


===== Delete Node =====================================================


mysql> select * from nodes;

+----+--------------+------------+------+------+------+------+-------+-----------+---------------+

| ID | Name         | Membership | CPUs | Rack | Rank | Arch | OS    | RunAction | InstallAction |

+----+--------------+------------+------+------+------+------+-------+-----------+---------------+

|  1 | dasandata |          1 |    4 |    0 |    0 | NULL | linux | os        | install       |

|  6 | compute-0-0  |          2 |    1 |    0 |    0 | NULL | linux | os        | install       |

|  7 | compute-0-1  |          2 |    1 |    0 |    1 | NULL | linux | os        | install       |

+----+--------------+------------+------+------+------+------+-------+-----------+---------------+

3 rows in set (0.00 sec)


mysql> delete from nodes where id=6 ;

Query OK, 1 row affected (0.00 sec)


mysql>

mysql> select * from nodes;

+----+--------------+------------+------+------+------+------+-------+-----------+---------------+

| ID | Name         | Membership | CPUs | Rack | Rank | Arch | OS    | RunAction | InstallAction |

+----+--------------+------------+------+------+------+------+-------+-----------+---------------+

|  1 | dasandata |          1 |    4 |    0 |    0 | NULL | linux | os        | install       |

|  7 | compute-0-1  |          2 |    1 |    0 |    1 | NULL | linux | os        | install       |

+----+--------------+------------+------+------+------+------+-------+-----------+---------------+

2 rows in set (0.00 sec)


mysql>

mysql> quit

Bye

[root@dasandata:~]#


===== Check ====================================================



[root@dasandata:~]# rocks list host

HOST          MEMBERSHIP CPUS RACK RANK RUNACTION INSTALLACTION

dasandata: Frontend   4    0    0    os        install

compute-0-1:  Compute    1    0    1    os        install

[root@dasandata:~]#

[root@dasandata:~]# cat /etc/hosts

# Added by rocks report host #

#        DO NOT MODIFY       #

#  Add any modifications to  #

#    /etc/hosts.local file   #


127.0.0.1       localhost.localdomain   localhost


10.0.255.254    compute-0-0.local       compute-0-0

10.0.255.253    compute-0-1.local       compute-0-1

10.0.0.1        dasandata.local      dasandata

192.168.0.155   dasandata.dasandata

[root@dasandata:~]#

[root@dasandata:~]# rocks list host interface

HOST          SUBNET  IFACE MAC               IP            NETMASK       MODULE NAME         VLAN OPTIONS CHANNEL

compute-0-1:  private eth0  00:0c:29:72:b8:f4 10.0.255.253  255.255.0.0   ------ compute-0-1  ---- ------- -------

dasandata: public  eth0  ----------------- 192.168.0.155 255.255.255.0 ------ dasandata ---- ------- -------

dasandata: private eth1  ----------------- 10.0.0.1      255.255.0.0   ------ dasandata ---- ------- -------

[root@dasandata:~]#

[root@dasandata:~]#

[root@dasandata:~]# rocks sync config

[root@dasandata:~]#

[root@dasandata:~]#

[root@dasandata:~]# rocks sync host network

[root@dasandata:~]#

[root@dasandata:~]#

[root@dasandata:~]# rocks list host

HOST          MEMBERSHIP CPUS RACK RANK RUNACTION INSTALLACTION

dasandata: Frontend   4    0    0    os        install

compute-0-1:  Compute    1    0    1    os        install

[root@dasandata:~]#

[root@dasandata:~]# cat /etc/hosts

# Added by rocks report host #

#        DO NOT MODIFY       #

#  Add any modifications to  #

#    /etc/hosts.local file   #


127.0.0.1       localhost.localdomain   localhost


10.0.255.253    compute-0-1.local       compute-0-1

10.0.0.1        dasandata.local      dasandata

192.168.0.155   dasandata.dasandata

[root@dasandata:~]#

[root@dasandata:~]# rocks list host interface

HOST          SUBNET  IFACE MAC               IP            NETMASK       MODULE NAME         VLAN OPTIONS CHANNEL

compute-0-1:  private eth0  00:0c:29:72:b8:f4 10.0.255.253  255.255.0.0   ------ compute-0-1  ---- ------- -------

dasandata: public  eth0  ----------------- 192.168.0.155 255.255.255.0 ------ dasandata ---- ------- -------

dasandata: private eth1  ----------------- 10.0.0.1      255.255.0.0   ------ dasandata ---- ------- -------

[root@dasandata:~]#

[root@dasandata:~]#

[root@dasandata:~]#


===== END ====================================


감사합니다.

댓글