1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

AWS AuroraでMaxScaleの(Read/Write split)がうまく起動しなかった

Last updated at Posted at 2016-10-01

MaxScaleでRead/Write splitを使っていたが、AWSのAuroraにしたところ
master、slaveの判断をMaxScaleの方でできなくなったのでmaxscale起動時にmaster,slave設定を手動で行う。

maxscale.conf

masterとslave(Auroraだとwriter、reader)サーバの設定の箇所

[m_shard1]
type=server
address=server-1
port=3306
protocol=MySQLBackend

[s_shard1]
type=server
address=server-2
port=3306
protocol=MySQLBackend

maxscale_start.sh

server名の先頭がm_だったらmaster、s_だったらslaveとする。

maxscale
sleep 5
for server in `maxadmin list servers | grep 3306 | awk '{print $1}'`
do
  i=`echo $server | cut -c 1`
  [ "x$i" = "xm_" ] && maxadmin set server $server master
  [ "x$i" = "xs_" ] && maxadmin set server $server slave
done
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?