Skip to content

I think you shouldn't use "SELECT * FROM" in mysql_gr_routing_check.sh #1

@kakuka4430

Description

@kakuka4430

Hello,

http://lefred.be/content/mysql-group-replication-as-ha-solution/

I tried to use your "mysql_gr_routing_check" in my test environment,
but I face on below error at health-check script.

[root@node1 ~]# mysql_gr_routing_check.sh 100 read
/usr/local/bin/mysql_gr_routing_check.sh: line 44: [: too many arguments

I investigated its error, and I found "queue" variable include two values by exec "echo $queue".
queue
0 0

So I think it is because "SELECT * FROM" gets four values while there are three variables(candidate readonly queue) at 37 line in "mysql_gr_routing_check.sh".

echo $(mysql --no-defaults -BN --connect-timeout=10 --host=$MYSQL_HOST --port=$MYSQL_PORT --user="$MYSQL_USERNAME" --password="$MYSQL_PASSWORD" -e 'SELECT * FROM sys.gr_member_routing_candidate_status' 2>/dev/null) | while read candidate readonly queue

In results, I think it should be as below.

echo $(mysql --no-defaults -BN --connect-timeout=10 --host=$MYSQL_HOST --port=$MYSQL_PORT --user="$MYSQL_USERNAME" --password="$MYSQL_PASSWORD" -e 'SELECT viable_candidate, read_only, transactions_to_cert FROM sys.gr_member_routing_candidate_status' 2>/dev/null) | while read candidate readonly queue

Best regard,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions