[MXS-3044] Route Select / Read Only to Node Master Only using readwritesplit Created: 2020-06-22  Updated: 2020-07-21  Resolved: 2020-07-21

Status: Closed
Project: MariaDB MaxScale
Component/s: readwritesplit
Affects Version/s: 2.4.7
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: febriyant Assignee: Unassigned
Resolution: Not a Bug Votes: 0
Labels: configuration, maxscale, readwritesplit
Environment:

Linux CentOS 7


Attachments: JPEG File Annotation 2020-06-23 092946.jpg    

 Description   

how to route query read only to node master ? I using readwritesplit routing.
temporary solution i remove node slave (db_190) from readwriteservice.

but if node master is failed i need manually link / add node_slave to readwriteservice.

this is my maxscale configuration

[DB_190]
type=server
address=192.168.101.190
port=13306
protocol=MySQLBackend
serv_weight=4
 
[DB_191]
type=server
address=192.168.101.191
port=13306
protocol=MySQLBackend
serv_weight=0
 
[MariaDB-Monitor-Test]
type=monitor
module=mysqlmon
servers=DB_190,DB_191
user=maxscale
password=C03D51AE93155CD3F74698A38697232C
monitor_interval=1000
auto_failover=true
detect_stale_master=true
failover_timeout=10
auto_rejoin=true
failcount=5
master_failure_timeout=2
verify_master_failure=true
switchover_timeout=90
replication_user=maxscale
replication_password=C03D51AE93155CD3F74698A38697232C
detect_stale_slave=true
 
[Read-Write-Service-Test]
type=service
router=readwritesplit
servers=DB_190,DB_191
user=maxscale
password=C03D51AE93155CD3F74698A38697232C
master_failure_mode=fail_on_write
strict_multi_stmt=false
use_sql_variables_in=master
master_reconnection=true
delayed_retry=true
delayed_retry_timeout=20s
transaction_replay=true
causal_reads=true
causal_reads_timeout=20s
weightby=serv_weight
slave_selection_criteria=LEAST_GLOBAL_CONNECTIONS
master_accept_reads=true
max_slave_connections=0
 
[Read-Write-Listener-Test]
type=listener
service=Read-Write-Service-Test
protocol=MySQLClient
port=13306
authenticator=MySQLAuth
authenticator_options=lower_case_table_names=true



 Comments   
Comment by febriyant [ 2020-06-23 ]

but after restart service but i run show service Read-Write-Service-Test
parameter master_accept_reads still false.

master_accept_reads = false 

Comment by markus makela [ 2020-06-29 ]

The readwritesplit will load balance reads across all available servers. It's not possible to force it to only use the master server.

Comment by febriyant [ 2020-07-03 ]

ok thanks @markus makela
but why variables master_accept_reads still false ? because i already set that variables is true.

Comment by markus makela [ 2020-07-03 ]

Hve you made runtime changes to the configuration via maxctrl or maxadmin? If so, then the MaxScale log should contain an entry about persisted configuration changes and there should be at least one file in /var/lib/maxscale/maxscale.cnf.d/. Removing those files will remove the persisted configuration changes.

Comment by febriyant [ 2020-07-06 ]

@markus makela, i setup from /etc/maxscale.cnf

and restart maxscale service.
after that i check from show service Read-Write-Service-Test

Comment by markus makela [ 2020-07-06 ]

Are there any files in /var/lib/maxscale/maxscale.cnf.d/?

Comment by febriyant [ 2020-07-21 ]

@markus.makela
i check at directory /var/lib/maxscale/maxscale.cnf.d/
i got 2 file
global-options.cnf & Read-Write-Service-Test.cnf

Comment by markus makela [ 2020-07-21 ]

If you remove /var/lib/maxscale/maxscale.cnf.d/Read-Write-Service-Test.cnf the changes in your configuration file shoud show up. You seem to have made runtime changes to MaxScale via maxctrl which were persisted on disk. The log should contain a message about these files and what they do.

Comment by febriyant [ 2020-07-21 ]

so about the step is like this

  1. remove file /var/lib/maxscale/maxscale.cnf.d/Read-Write-Service-Test.cnf
  2. change configuration /etc/maxscale.cnf
  3. restart service maxscale

what steps should i do ?

Comment by markus makela [ 2020-07-21 ]

Those are the exact steps you should do.

Comment by febriyant [ 2020-07-21 ]

thanks this variable master_accept_reads already true.
after i remove file at /var/lib/maxscale/maxscale.cnf.d/Read-Write-Service-Test.cnf

Generated at Thu Feb 08 04:18:33 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.