From 3482870e30ce25a08ee4d2cc11c1fd43419354ad Mon Sep 17 00:00:00 2001 From: rameshvs02 Date: Fri, 13 Jan 2017 15:31:31 +0530 Subject: [PATCH 1/2] Fixed BLD-603 --- proxysql-admin | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/proxysql-admin b/proxysql-admin index 993bfbd..f486bab 100755 --- a/proxysql-admin +++ b/proxysql-admin @@ -25,7 +25,7 @@ fi usage () { echo "Usage: [ options ]" echo "Options:" - echo " --config-file Read login credentials form a configuration file (overrides any login credentials specified on the command line)" + echo " --config-file Read login credentials from a configuration file (overrides any login credentials specified on the command line)" echo " --quick-demo Setup a quick demo with no authentication" echo " --proxysql-username=user_name Username for connecting to the ProxySQL service" echo " --proxysql-password[=password] Password for connecting to the ProxySQL service" @@ -41,9 +41,9 @@ usage () { echo " --monitor-password[=password] Password for monitoring Percona XtraDB Cluster nodes through ProxySQL" echo " --enable, -e Auto-configure Percona XtraDB Cluster nodes into ProxySQL" echo " --disable, -d Remove any Percona XtraDB Cluster configurations from ProxySQL" - echo " --node-check-interval Interval for monitoring node checker script (in milliseconds)" - echo " --mode ProxySQL read/write configuration mode, currently supporting: 'loadbal' and 'singlewrite' (the default) modes" - echo " --write-node Writer node to accept write statments. This option is supported only when using --mode=singlewrite" + echo " --node-check-interval=3000 Interval for monitoring node checker script (in milliseconds)" + echo " --mode=[loadbal|singlewrite] ProxySQL read/write configuration mode, currently supporting: 'loadbal' and 'singlewrite' (the default) modes" + echo " --write-node=host_name:port Writer node to accept write statments. This option is supported only when using --mode=singlewrite" echo " --adduser Adds the Percona XtraDB Cluster application user to the ProxySQL database" echo " --version, -v Print version info" } @@ -177,8 +177,8 @@ do shift disable=1 ;; - --galera-check-interval ) - GALERA_CHECK_INTERVAL="$2" + --node-check-interval ) + NODE_CHECK_INTERVAL="$2" shift 2 ;; --mode ) @@ -319,8 +319,8 @@ else CLUSTER_APP_PASSWORD='' fi -if [[ -z "$GALERA_CHECK_INTERVAL" ]]; then - GALERA_CHECK_INTERVAL=3000 +if [[ -z "$NODE_CHECK_INTERVAL" ]]; then + NODE_CHECK_INTERVAL=3000 fi if [[ -z "$MODE" ]]; then @@ -592,7 +592,7 @@ enable_proxysql(){ # Adding proxysql galera check scheduler proxysql_exec "DELETE FROM SCHEDULER WHERE ID=10;" check_cmd $? - proxysql_exec "INSERT INTO SCHEDULER (id,active,interval_ms,filename,arg1,arg2,arg3,arg4,arg5) VALUES (10,1,$GALERA_CHECK_INTERVAL,'$PROXYSQL_GALERA_CHECK',$WRITE_HOSTGROUP_ID,$READ_HOSTGROUP_ID,${#wsrep_address[@]},1,'/var/lib/proxysql/proxysql_galera_check.log');" + proxysql_exec "INSERT INTO SCHEDULER (id,active,interval_ms,filename,arg1,arg2,arg3,arg4,arg5) VALUES (10,1,$NODE_CHECK_INTERVAL,'$PROXYSQL_GALERA_CHECK',$WRITE_HOSTGROUP_ID,$READ_HOSTGROUP_ID,${#wsrep_address[@]},1,'/var/lib/proxysql/proxysql_galera_check.log');" check_cmd $? "Failed to add the Percona XtraDB Cluster monitoring scheduler in ProxySQL" # Adding Percona XtraDB Cluster membership checking scheduler From 614416b7fc14f7c7a9cc1a96cdd3e3b976d6fd0b Mon Sep 17 00:00:00 2001 From: rameshvs02 Date: Fri, 13 Jan 2017 16:45:16 +0530 Subject: [PATCH 2/2] Fixed BLD-604 --- proxysql_node_monitor | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/proxysql_node_monitor b/proxysql_node_monitor index faf5519..a5663aa 100755 --- a/proxysql_node_monitor +++ b/proxysql_node_monitor @@ -68,7 +68,7 @@ update_cluster(){ ws_ip=$(echo $i | cut -d':' -f1) ws_port=$(echo $i | cut -d':' -f2) echo "Node ${i} does not exists in cluster membership!" >> $ERR_FILE - proxysql_exec "UPDATE mysql_servers set status = 'OFFLINE_HARD' WHERE hostgroup_id = $HOSTGROUP_ID and hostname='$ws_ip' and port=$ws_port;" + proxysql_exec "UPDATE mysql_servers set status = 'OFFLINE_HARD', weight=1000 WHERE hostgroup_id = $HOSTGROUP_ID and hostname='$ws_ip' and port=$ws_port;" check_cmd $? "Cannot update Percona XtraDB Cluster node $ws_ip:$ws_port to ProxySQL database, Please check proxysql credentials" proxysql_exec "LOAD MYSQL SERVERS TO RUNTIME; SAVE MYSQL SERVERS TO DISK;" echo "${i} node set to OFFLINE_HARD status to ProxySQL database." >> $ERR_FILE @@ -84,7 +84,7 @@ update_cluster(){ ws_status=$(echo `proxysql_exec "SELECT status from mysql_servers WHERE hostname='$ws_ip' and port=$ws_port"`) echo "Cluster node (${i}) current status '$ws_status' in ProxySQL database!" >> $ERR_FILE if [ "$ws_status" == "OFFLINE_HARD" ]; then - proxysql_exec "UPDATE mysql_servers set status = 'OFFLINE_SOFT' WHERE hostname='$ws_ip' and port=$ws_port;" + proxysql_exec "UPDATE mysql_servers set status = 'OFFLINE_SOFT', weight=1000 WHERE hostname='$ws_ip' and port=$ws_port;" check_cmd $? "Cannot update Percona XtraDB Cluster node $ws_ip:$ws_port to ProxySQL database, Please check proxysql credentials" proxysql_exec "LOAD MYSQL SERVERS TO RUNTIME; SAVE MYSQL SERVERS TO DISK;" echo "${i} node set to OFFLINE_SOFT status to ProxySQL database." >> $ERR_FILE @@ -99,12 +99,12 @@ update_cluster(){ mode_change_check(){ checkwriter_hid=`proxysql_exec "select hostgroup_id from mysql_servers where comment='WRITE' and status='OFFLINE_SOFT'"` if [[ -n "$checkwriter_hid" ]]; then - proxysql_exec "UPDATE mysql_servers set hostgroup_id = $READ_HOSTGROUP_ID, comment='READ' WHERE comment='WRITE' and status='OFFLINE_SOFT'" + proxysql_exec "UPDATE mysql_servers set hostgroup_id = $READ_HOSTGROUP_ID, comment='READ', weight=1000 WHERE comment='WRITE' and status='OFFLINE_SOFT'" check_cmd $? "Cannot update Percona XtraDB Cluster writer node in ProxySQL database, Please check proxysql credentials" current_hosts=(`proxysql_exec "SELECT hostname,port FROM mysql_servers WHERE status='ONLINE' and comment='READ' ORDER BY random() LIMIT 1" | sed 's|\t|:|g' | tr '\n' ' '`) ws_ip=$(echo $current_hosts | cut -d':' -f1) ws_port=$(echo $current_hosts | cut -d':' -f2) - proxysql_exec "UPDATE mysql_servers set hostgroup_id = $WRITE_HOSTGROUP_ID, comment='WRITE' WHERE hostname='$ws_ip' and port=$ws_port" + proxysql_exec "UPDATE mysql_servers set hostgroup_id = $WRITE_HOSTGROUP_ID, comment='WRITE', weight=1000000 WHERE hostname='$ws_ip' and port=$ws_port" check_cmd $? "Cannot update Percona XtraDB Cluster writer node in ProxySQL database, Please check proxysql credentials" proxysql_exec "LOAD MYSQL SERVERS TO RUNTIME; SAVE MYSQL SERVERS TO DISK;" fi