【MySQL】maxscale 读写分离信息查看

1.查看maxscale的帮助信息。

[root@mysql1 trace]# maxadmin -S /mysql/app/maxscale/tmp/maxadmin.sock
MaxScale> help 

--查看帮助信息 
    add user - Add an administrative account for using maxadmin over the network
    add readonly-user - Add a read-only account for using maxadmin over the network
    add server - Add a new server to a service

remove:
    remove user - Remove account for using maxadmin over the network
    remove server - Remove a server from a service or a monitor

create:
    create server - Create a new server
    create listener - Create a new listener for a service
    create monitor - Create a new monitor

destroy:
    destroy server - Destroy a server
    destroy listener - Destroy a listener
    destroy monitor - Destroy a monitor

alter:
    alter server - Alter server parameters
    alter monitor - Alter monitor parameters
    alter service - Alter service parameters
    alter maxscale - Alter maxscale parameters

set:
    set server - Set the status of a server
    set pollsleep - Set poll sleep period
    set nbpolls - Set non-blocking polls
    set log_throttling - Set the log throttling configuration

clear:
    clear server - Clear server status

disable:
    disable log-priority - Disable a logging priority
    disable sessionlog-priority - [Deprecated] Disable a logging priority for a particular session
    disable root - Disable root access
    disable syslog - Disable syslog logging
    disable maxlog - Disable MaxScale logging
    disable account - Disable Linux user

enable:
    enable log-priority - Enable a logging priority
    enable sessionlog-priority - [Deprecated] Enable a logging priority for a session
    enable root - Enable root user access to a service
    enable syslog - Enable syslog logging
    enable maxlog - Enable MaxScale logging
    enable account - Activate a Linux user account for administrative MaxAdmin use
    enable readonly-account - Activate a Linux user account for read-only MaxAdmin use

flush:
    flush log - Flush the content of a log file and reopen it
    flush logs - Flush the content of a log file and reopen it

list:
    list clients - List all the client connections to MaxScale
    list dcbs - List all active connections within MaxScale
    list filters - List all filters
    list listeners - List all listeners
    list modules - List all currently loaded modules
    list monitors - List all monitors
    list services - List all services
    list servers - List all servers
    list sessions - List all the active sessions within MaxScale
    list threads - List the status of the polling threads in MaxScale
    list commands - List registered commands

reload:
    reload config - [Deprecated] Reload the configuration
    reload dbusers - Reload the database users for a service

restart:
    restart monitor - Restart a monitor
    restart service - Restart a service
    restart listener - Restart a listener

shutdown:
    shutdown maxscale - Initiate a controlled shutdown of MaxScale
    shutdown monitor - Stop a monitor
    shutdown service - Stop a service
    shutdown listener - Stop a listener

show:
    show dcbs - Show all DCBs
    show dbusers - [deprecated] Show user statistics
    show authenticators - Show authenticator diagnostics for a service
    show epoll - Show the polling system statistics
    show eventstats - Show event queue statistics
    show filter - Show filter details
    show filters - Show all filters
    show log_throttling - Show the current log throttling setting (count, window (ms), suppression (ms))
    show modules - Show all currently loaded modules
    show monitor - Show monitor details
    show monitors - Show all monitors
    show persistent - Show the persistent connection pool of a server
    show server - Show server details
    show servers - Show all servers
    show serversjson - Show all servers in JSON
    show services - Show all configured services in MaxScale
    show service - Show a single service in MaxScale
    show session - Show session details
    show sessions - Show all active sessions in MaxScale
    show tasks - Show all active housekeeper tasks in MaxScale
    show threads - Show the status of the worker threads in MaxScale
    show users - Show enabled Linux accounts
    show version - Show the MaxScale version number
sync:
    sync logs - Flush log files to disk
call:
    call command - Call module command
ping:
    ping workers - Ping Workers

2.maxscale show 命令使用。

(1)读写请求的统计。
MaxScale> show dcbs
DCB: 0x17a8490
	DCB state:          DCB for listening socket
	Service:            Read-Only-Service
	Role:                     Service Listener
	Statistics:
		No. of Reads:             0
		No. of Writes:            0
		No. of Buffered Writes:   0
		No. of Accepts:           20
		No. of High Water Events: 0
		No. of Low Water Events:  0
DCB: 0x17ccf10
	DCB state:          DCB for listening socket
	Service:            Read-Write-Service
	Role:                     Service Listener
	Statistics:
		No. of Reads:             0
		No. of Writes:            0
		No. of Buffered Writes:   0
		No. of Accepts:           17
		No. of High Water Events: 0
		No. of Low Water Events:  0
DCB: 0x17cebd0
	DCB state:          DCB for listening socket
	Service:            MaxAdmin-Service
	Role:                     Service Listener
	Statistics:
		No. of Reads:             0
		No. of Writes:            0
		No. of Buffered Writes:   0
		No. of Accepts:           1
		No. of High Water Events: 0
		No. of Low Water Events:  0
DCB: 0x17f3b40
	DCB state:          DCB in the polling loop
	Service:            MaxAdmin-Service
	Connected to:       localhost
	Username:           root
	Role:                     Client Request Handler
	Statistics:
		No. of Reads:             4
		No. of Writes:            0
		No. of Buffered Writes:   192
		No. of Accepts:           0
		No. of High Water Events: 0
		No. of Low Water Events:  0
(2)查看用户信息。
MaxScale> show dbusers Read-Write-Service
User names (Read-Write-Listener): root@localhost mysql.session@localhost mysql.sys@localhost root@% repuser@127.0.0.1 repuser@% repuser@localhost maxscale@% mysql.session@localhost maxscale@% 
MaxScale> 
(3)查看授权信息。
MaxScale> show authenticators Read-Write-Service 
User names (Read-Write-Listener): root@localhost mysql.session@localhost mysql.sys@localhost root@% repuser@127.0.0.1 repuser@% repuser@localhost maxscale@% mysql.session@localhost maxscale@% 
MaxScale>
(4)poll 多路复用统计信息查看。
MaxScale> show epoll 

Poll Statistics.

No. of epoll cycles:                           10237
No. of epoll cycles with wait:                 2036
No. of epoll calls returning events:           393
No. of non-blocking calls returning events:    57
No. of read events:                            286
No. of write events:                           354
No. of error events:                           0
No. of hangup events:                          0
No. of accept events:                          38
Total event queue length:                      1
Average event queue length:                    1
Maximum event queue length:                    1
No of poll completions with descriptors
	No. of descriptors	No. of poll completions.
	 1			393
	 2			0
	 3			0
	 4			0
	 5			0
	 6			0
	 7			0
	 8			0
	 9			0
	>= 10			0

(5)执行时间统计信息
MaxScale> show eventstats 

Event statistics.
Maximum queue time:             000ms
Maximum execution time:         000ms
Maximum event queue length:     1
Average event queue length:     1

               |    Number of events
Duration       | Queued     | Executed
---------------+------------+-----------
 < 100ms       | 395        | 394       
  100 -  200ms | 0          | 0         
  200 -  300ms | 0          | 0         
  300 -  400ms | 0          | 0         
  400 -  500ms | 0          | 0         
  500 -  600ms | 0          | 0         
  600 -  700ms | 0          | 0         
  700 -  800ms | 0          | 0         
  800 -  900ms | 0          | 0         
  900 - 1000ms | 0          | 0         
 1000 - 1100ms | 0          | 0         
 1100 - 1200ms | 0          | 0         
 1200 - 1300ms | 0          | 0         
 1300 - 1400ms | 0          | 0         
 1400 - 1500ms | 0          | 0         
 1500 - 1600ms | 0          | 0         
 1600 - 1700ms | 0          | 0         
 1700 - 1800ms | 0          | 0         
 1800 - 1900ms | 0          | 0         
 1900 - 2000ms | 0          | 0         
 2000 - 2100ms | 0          | 0         
 2100 - 2200ms | 0          | 0         
 2200 - 2300ms | 0          | 0         
 2300 - 2400ms | 0          | 0         
 2400 - 2500ms | 0          | 0         
 2500 - 2600ms | 0          | 0         
 2600 - 2700ms | 0          | 0         
 2700 - 2800ms | 0          | 0         
 2800 - 2900ms | 0          | 0         
 2900 - 3000ms | 0          | 0         
 > 3000ms      | 0          | 0
(6)查看过滤信息 
MaxScale> show filters 
MaxScale> 
(7)查看日志节流的数量 
MaxScale> show log_throttling
10 1000 10000
(8)查看加载的模块
MaxScale> show modules
Modules.
----------------+-----------------+---------+-------+-------------------------
Module Name     | Module Type     | Version | API   | Status
----------------+-----------------+---------+-------+-------------------------
qc_sqlite       | QueryClassifier | V1.0.0  | 2.0.0 | GA
MySQLAuth       | Authenticator   | V1.1.0  | 2.1.0 | GA
mariadbclient   | Protocol        | V1.1.0  | 1.1.0 | GA
MaxAdminAuth    | Authenticator   | V2.1.0  | 2.1.0 | GA
maxscaled       | Protocol        | V2.0.0  | 1.1.0 | GA
MySQLBackendAuth | Authenticator   | V1.0.0  | 2.1.0 | GA
mariadbbackend  | Protocol        | V2.0.0  | 1.1.0 | GA
mariadbmon      | Monitor         | V1.5.0  | 3.1.0 | GA
readconnroute   | Router          | V1.1.0  | 3.0.0 | GA
readwritesplit  | Router          | V1.1.0  | 3.0.0 | GA
cli             | Router          | V1.0.0  | 3.0.0 | GA
----------------+-----------------+---------+-------+-------------------------

(9)查看监控信息 
MaxScale> show monitor MySQL-Monitor
Monitor:                0x17a3ef0
Name:                   MySQL-Monitor
State:                  Running
Times monitored:        1040
Sampling interval:      2000 milliseconds
Connect Timeout:        3 seconds
Read Timeout:           1 seconds
Write Timeout:          2 seconds
Connect attempts:       1 
Monitored servers:      [192.168.1.11]:3306, [192.168.1.12]:3306, [192.168.1.13]:3306, [192.168.1.14]:3306
Automatic failover:     Disabled
Failcount:              5
Failover timeout:       90
Switchover timeout:     90
Automatic rejoin:       Disabled
Enforce read-only:      Disabled
MaxScale monitor ID:    0
Detect replication lag: Disabled
Detect stale master:    Enabled

Server information:
-------------------

Server:                 server1
Server ID:              113306
Read only:              NO
Slave configured:       NO

Server:                 server2
Server ID:              123306
Read only:              YES
Slave configured:       YES
Slave IO running:       YES
Slave SQL running:      YES
Master ID:              113306
Master binlog file:     230
Master binlog position: 0

Server:                 server3
Server ID:              133306
Read only:              YES
Slave configured:       YES
Slave IO running:       YES
Slave SQL running:      YES
Master ID:              113306
Master binlog file:     230
Master binlog position: 0

Server:                 server4
Server ID:              143306
Read only:              YES
Slave configured:       YES
Slave IO running:       YES
Slave SQL running:      YES
Master ID:              113306
Master binlog file:     230
Master binlog position: 0
--由此可见读写模式,主从复制的状态均可通过maxscale查看。
(10)查看所有的监控信息
MaxScale> show monitors
Monitor:                0x17a3ef0
Name:                   MySQL-Monitor
State:                  Running
Times monitored:        1073
Sampling interval:      2000 milliseconds
Connect Timeout:        3 seconds
Read Timeout:           1 seconds
Write Timeout:          2 seconds
Connect attempts:       1 
Monitored servers:      [192.168.1.11]:3306, [192.168.1.12]:3306, [192.168.1.13]:3306, [192.168.1.14]:3306
Automatic failover:     Disabled
Failcount:              5
Failover timeout:       90
Switchover timeout:     90
Automatic rejoin:       Disabled
Enforce read-only:      Disabled
MaxScale monitor ID:    0
Detect replication lag: Disabled
Detect stale master:    Enabled

Server information:
-------------------

Server:                 server1
Server ID:              113306
Read only:              NO
Slave configured:       NO

Server:                 server2
Server ID:              123306
Read only:              YES
Slave configured:       YES
Slave IO running:       YES
Slave SQL running:      YES
Master ID:              113306
Master binlog file:     230
Master binlog position: 0

Server:                 server3
Server ID:              133306
Read only:              YES
Slave configured:       YES
Slave IO running:       YES
Slave SQL running:      YES
Master ID:              113306
Master binlog file:     230
Master binlog position: 0

Server:                 server4
Server ID:              143306
Read only:              YES
Slave configured:       YES
Slave IO running:       YES
Slave SQL running:      YES
Master ID:              113306
Master binlog file:     230
Master binlog position: 0
(11)查看持久性连接
MaxScale> show persistent server2
Number of persistent DCBs: 0
MaxScale> show persistent server1
Number of persistent DCBs: 0
(12)查看server的详细信息 
MaxScale> show server server1
Server 0x17a0920 (server1)
	Server:                              192.168.1.11
	Status:                              Master, Running
	Protocol:                            MySQLBackend
	Port:                                3306
	Server Version:                      5.7.34-log
	Node Id:                             113306
	Master Id:                           -1
	Last event:                          server_up
	Triggered at:                        Sat, 03 Aug 2024 08:01:23 GMT
	Slave Ids:                           123306, 133306 , 143306 
	Repl Depth:                          0
	Server Parameters:
	                                       serv_weight	1   #很少分发到这个,权重低
	Number of connections:               16
	Current no. of conns:                0
	Current no. of operations:           0
	Number of routed packets:            48
(13)查看所有server的详细信息 
MaxScale> show servers  
Server 0x17a0920 (server1)
	Server:                              192.168.1.11
	Status:                              Master, Running
	Protocol:                            MySQLBackend
	Port:                                3306
	Server Version:                      5.7.34-log
	Node Id:                             113306
	Master Id:                           -1
	Last event:                          server_up
	Triggered at:                        Sat, 03 Aug 2024 08:01:23 GMT
	Slave Ids:                           123306, 133306 , 143306 
	Repl Depth:                          0
	Server Parameters:
	                                       serv_weight	1   #很少分发到这个,权重低
	Number of connections:               16
	Current no. of conns:                0
	Current no. of operations:           0
	Number of routed packets:            48
Server 0x179f620 (server2)
	Server:                              192.168.1.12
	Status:                              Slave, Running
	Protocol:                            MySQLBackend
	Port:                                3306
	Server Version:                      5.7.34-log
	Node Id:                             123306
	Master Id:                           113306
	Last event:                          server_up
	Triggered at:                        Sat, 03 Aug 2024 08:01:23 GMT
	Slave Ids:                           
	Repl Depth:                          1
	Server Parameters:
	                                       serv_weight	3
	Number of connections:               7
	Current no. of conns:                1
	Current no. of operations:           0
	Number of routed packets:            20
Server 0x179e320 (server3)
	Server:                              192.168.1.13
	Status:                              Slave, Running
	Protocol:                            MySQLBackend
	Port:                                3306
	Server Version:                      5.7.34-log
	Node Id:                             133306
	Master Id:                           113306
	Last event:                          server_up
	Triggered at:                        Sat, 03 Aug 2024 08:01:23 GMT
	Slave Ids:                           
	Repl Depth:                          1
	Server Parameters:
	                                       serv_weight	3
	Number of connections:               6
	Current no. of conns:                0
	Current no. of operations:           0
	Number of routed packets:            18
Server 0x179d020 (server4)
	Server:                              192.168.1.14
	Status:                              Slave, Running
	Protocol:                            MySQLBackend
	Port:                                3306
	Server Version:                      5.7.34-log
	Node Id:                             143306
	Master Id:                           113306
	Last event:                          server_up
	Triggered at:                        Sat, 03 Aug 2024 08:01:23 GMT
	Slave Ids:                           
	Repl Depth:                          1
	Server Parameters:
	                                       serv_weight	3
	Number of connections:               6
	Current no. of conns:                0
	Current no. of operations:           0
	Number of routed packets:            18
(14)以JSON的格式展示server的详细信息 
MaxScale> show serversjson
{
    "links": {
        "self": "/servers/"
    },
    "data": [
        {
            "id": "server1",
            "type": "servers",
            "relationships": {
                "services": {
                    "links": {
                        "self": "/services/"
                    },
                    "data": [
                        {
                            "id": "Read-Write-Service",
                            "type": "services"
                        }
                    ]
                },
                "monitors": {
                    "links": {
                        "self": "/monitors/"
                    },
                    "data": [
                        {
                            "id": "MySQL-Monitor",
                            "type": "monitors"
                        }
                    ]
                }
            },
            "attributes": {
                "parameters": {
                    "address": "192.168.1.11",
                    "port": 3306,
                    "protocol": "MySQLBackend",
                    "authenticator": "MySQLBackendAuth",
                    "serv_weight": "1   #很少分发到这个,权重低"
                },
                "state": "Master, Running",
                "version_string": "5.7.34-log",
                "node_id": 113306,
                "master_id": -1,
                "replication_depth": 0,
                "last_event": "server_up",
                "triggered_at": "Sat, 03 Aug 2024 08:01:23 GMT",
                "slaves": [
                    123306,
                    133306,
                    143306
                ],
                "statistics": {
                    "connections": 0,
                    "total_connections": 16,
                    "persistent_connections": 0,
                    "active_operations": 0,
                    "routed_packets": 48
                }
            },
            "links": {
                "self": "/servers/server1"
            }
        },
        {
            "id": "server2",
            "type": "servers",
            "relationships": {
                "services": {
                    "links": {
                        "self": "/services/"
                    },
                    "data": [
                        {
                            "id": "Read-Only-Service",
                            "type": "services"
                        }
                    ]
                },
                "monitors": {
                    "links": {
                        "self": "/monitors/"
                    },
                    "data": [
                        {
                            "id": "MySQL-Monitor",
                            "type": "monitors"
                        }
                    ]
                }
            },
            "attributes": {
                "parameters": {
                    "address": "192.168.1.12",
                    "port": 3306,
                    "protocol": "MySQLBackend",
                    "authenticator": "MySQLBackendAuth",
                    "serv_weight": "3"
                },
                "state": "Slave, Running",
                "version_string": "5.7.34-log",
                "node_id": 123306,
                "master_id": 113306,
                "replication_depth": 1,
                "last_event": "server_up",
                "triggered_at": "Sat, 03 Aug 2024 08:01:23 GMT",
                "slaves": [],
                "statistics": {
                    "connections": 1,
                    "total_connections": 7,
                    "persistent_connections": 0,
                    "active_operations": 0,
                    "routed_packets": 20
                }
            },
            "links": {
                "self": "/servers/server2"
            }
        },
        {
            "id": "server3",
            "type": "servers",
            "relationships": {
                "services": {
                    "links": {
                        "self": "/services/"
                    },
                    "data": [
                        {
                            "id": "Read-Only-Service",
                            "type": "services"
                        }
                    ]
                },
                "monitors": {
                    "links": {
                        "self": "/monitors/"
                    },
                    "data": [
                        {
                            "id": "MySQL-Monitor",
                            "type": "monitors"
                        }
                    ]
                }
            },
            "attributes": {
                "parameters": {
                    "address": "192.168.1.13",
                    "port": 3306,
                    "protocol": "MySQLBackend",
                    "authenticator": "MySQLBackendAuth",
                    "serv_weight": "3"
                },
                "state": "Slave, Running",
                "version_string": "5.7.34-log",
                "node_id": 133306,
                "master_id": 113306,
                "replication_depth": 1,
                "last_event": "server_up",
                "triggered_at": "Sat, 03 Aug 2024 08:01:23 GMT",
                "slaves": [],
                "statistics": {
                    "connections": 0,
                    "total_connections": 6,
                    "persistent_connections": 0,
                    "active_operations": 0,
                    "routed_packets": 18
                }
            },
            "links": {
                "self": "/servers/server3"
            }
        },
        {
            "id": "server4",
            "type": "servers",
            "relationships": {
                "services": {
                    "links": {
                        "self": "/services/"
                    },
                    "data": [
                        {
                            "id": "Read-Only-Service",
                            "type": "services"
                        }
                    ]
                },
                "monitors": {
                    "links": {
                        "self": "/monitors/"
                    },
                    "data": [
                        {
                            "id": "MySQL-Monitor",
                            "type": "monitors"
                        }
                    ]
                }
            },
            "attributes": {
                "parameters": {
                    "address": "192.168.1.14",
                    "port": 3306,
                    "protocol": "MySQLBackend",
                    "authenticator": "MySQLBackendAuth",
                    "serv_weight": "3"
                },
                "state": "Slave, Running",
                "version_string": "5.7.34-log",
                "node_id": 143306,
                "master_id": 113306,
                "replication_depth": 1,
                "last_event": "server_up",
                "triggered_at": "Sat, 03 Aug 2024 08:01:23 GMT",
                "slaves": [],
                "statistics": {
                    "connections": 0,
                    "total_connections": 6,
                    "persistent_connections": 0,
                    "active_operations": 0,
                    "routed_packets": 18
                }
            },
            "links": {
                "self": "/servers/server4"
            }
        }
    ]
}MaxScale>
(15)查看服务信息 
MaxScale> show services
	Service:                             Read-Only-Service
	Router:                              readconnroute
	State:                               Started
	Number of router sessions:   	19
	Current no. of router sessions:	2
	Number of queries forwarded:   	56
	Connection distribution based on serv_weight server parameter.
		Server               Target % Connections
		server2              33.3%     1
		server3              33.3%     0
		server4              33.3%     0
	Started:                             Sat Aug  3 16:01:23 2024
	Root user access:                    Disabled
	Backend databases:
		[192.168.1.12]:3306    Protocol: MySQLBackend    Name: server2
		[192.168.1.13]:3306    Protocol: MySQLBackend    Name: server3
		[192.168.1.14]:3306    Protocol: MySQLBackend    Name: server4
	Routing weight parameter:            serv_weight
	Total connections:                   20
	Currently connected:                 2
	Service:                             Read-Write-Service
	Router:                              readwritesplit
	State:                               Started

	use_sql_variables_in:      all
	slave_selection_criteria:  LEAST_CURRENT_OPERATIONS
	master_failure_mode:       fail_instantly
	max_slave_replication_lag: 3600
	retry_failed_reads:        true
	strict_multi_stmt:         false
	strict_sp_calls:           false
	disable_sescmd_history:    true
	max_sescmd_history:        0
	master_accept_reads:       false

	Number of router sessions:           	16
	Current no. of router sessions:      	1
	Number of queries forwarded:          	32
	Number of queries forwarded to master:	0 (0.00%)
	Number of queries forwarded to slave: 	32 (100.00%)
	Number of queries forwarded to all:   	16 (50.00%)
	Started:                             Sat Aug  3 16:01:23 2024
	Root user access:                    Enabled
	Backend databases:
		[192.168.1.11]:3306    Protocol: MySQLBackend    Name: server1
	Total connections:                   17
	Currently connected:                 1
	Service:                             MaxAdmin-Service
	Router:                              cli
	State:                               Started
	Started:                             Sat Aug  3 16:01:23 2024
	Root user access:                    Disabled
	Backend databases:
	Total connections:                   2
	Currently connected:                 2
(16)查看某个服务的具体信息 
MaxScale> show service Read-Only-Service
	Service:                             Read-Only-Service
	Router:                              readconnroute
	State:                               Started
	Number of router sessions:   	19
	Current no. of router sessions:	2
	Number of queries forwarded:   	56
	Connection distribution based on serv_weight server parameter.
		Server               Target % Connections
		server2              33.3%     1
		server3              33.3%     0
		server4              33.3%     0
	Started:                             Sat Aug  3 16:01:23 2024
	Root user access:                    Disabled
	Backend databases:
		[192.168.1.12]:3306    Protocol: MySQLBackend    Name: server2
		[192.168.1.13]:3306    Protocol: MySQLBackend    Name: server3
		[192.168.1.14]:3306    Protocol: MySQLBackend    Name: server4
	Routing weight parameter:            serv_weight
	Total connections:                   20
	Currently connected:                 2
(17)查看某个会话的信息 
MaxScale> show session 41
Session 41
	State:               Session ready for routing
	Service:             MaxAdmin-Service
	Client Address:          root@localhost
	Connected:               Sat Aug  3 16:17:58 2024

	Idle:                0 seconds
(18)查看所有会话的信息 
MaxScale> show sessions
Session 41
	State:               Session ready for routing
	Service:             MaxAdmin-Service
	Client Address:          root@localhost
	Connected:               Sat Aug  3 16:17:58 2024

	Idle:                0 seconds
Session 43
	State:               Session ready for routing
	Service:             Read-Only-Service
	Client Address:          maxscale@::ffff:192.168.1.12
	Connected:               Sat Aug  3 16:41:18 2024

	Idle:                258 seconds
(19)查看活跃的管家 
MaxScale> show tasks
Name                      | Type     | Frequency | Next Due
--------------------------+----------+-----------+-------------------------
MaxScale> 
(20)查看线程 
MaxScale> show threads
Polling Threads.

 ID | State      | #descriptors (curr) | #descriptors (tot)  |
----+------------+---------------------+---------------------+
  0 | Processing |                   4 |                  76 |
(21)查看活跃的Linux账号 
MaxScale> show users
Enabled Linux accounts (secure)    : root
Created network accounts (insecure): admin
(22)查看版本 
MaxScale> show version
2.2.11

3.maxscale list 命令 

(1)查看客户端 
Client Connections
-----------------+------------------+----------------------+------------
 Client          | DCB              | Service              | Session
-----------------+------------------+----------------------+------------
 localhost       |        0x17f3b40 | MaxAdmin-Service     |  0x17f5760
 ::ffff:192.168.1.12 |        0x17f3fa0 | Read-Only-Service    |  0x17f4260
-----------------+------------------+----------------------+------------
(2)查看DCB:Descriptor Control Block
MaxScale> list dcbs
Descriptor Control Blocks
------------------+----------------------------+--------------------+----------
 DCB              | State                      | Service            | Remote
------------------+----------------------------+--------------------+----------
 0x17a8490        | DCB for listening socket   | Read-Only-Service  | 
 0x17ccf10        | DCB for listening socket   | Read-Write-Service | 
 0x17cebd0        | DCB for listening socket   | MaxAdmin-Service   | 
 0x17f3b40        | DCB in the polling loop    | MaxAdmin-Service   | localhost
 0x17f3fa0        | DCB in the polling loop    | Read-Only-Service  | ::ffff:192.168.1.12
 0x17f6680        | DCB in the polling loop    | Read-Only-Service  | ::ffff:192.168.1.12
------------------+----------------------------+--------------------+----------
(3)查看过滤器 
MaxScale> list filters
(4)查看监听信息 
MaxScale> list listeners
Listeners.
---------------------+---------------------+--------------------+-----------------+-------+--------
Name                 | Service Name        | Protocol Module    | Address         | Port  | State
---------------------+---------------------+--------------------+-----------------+-------+--------
Read-Only-Listener   | Read-Only-Service   | MySQLClient        | *               |  4008 | Running
Read-Write-Listener  | Read-Write-Service  | MySQLClient        | *               |  4006 | Running
MaxAdmin-Listener    | MaxAdmin-Service    | maxscaled          | /mysql/app/maxscale/tmp/maxadmin.sock |     0 | Running
---------------------+---------------------+--------------------+-----------------+-------+--------
(5)查看模块信息 
MaxScale> list modules
Modules.
----------------+-----------------+---------+-------+-------------------------
Module Name     | Module Type     | Version | API   | Status
----------------+-----------------+---------+-------+-------------------------
qc_sqlite       | QueryClassifier | V1.0.0  | 2.0.0 | GA
MySQLAuth       | Authenticator   | V1.1.0  | 2.1.0 | GA
mariadbclient   | Protocol        | V1.1.0  | 1.1.0 | GA
MaxAdminAuth    | Authenticator   | V2.1.0  | 2.1.0 | GA
maxscaled       | Protocol        | V2.0.0  | 1.1.0 | GA
MySQLBackendAuth | Authenticator   | V1.0.0  | 2.1.0 | GA
mariadbbackend  | Protocol        | V2.0.0  | 1.1.0 | GA
mariadbmon      | Monitor         | V1.5.0  | 3.1.0 | GA
readconnroute   | Router          | V1.1.0  | 3.0.0 | GA
readwritesplit  | Router          | V1.1.0  | 3.0.0 | GA
cli             | Router          | V1.0.0  | 3.0.0 | GA
----------------+-----------------+---------+-------+-------------------------
(6)查看监控服务 
MaxScale> list monitors
---------------------+---------------------
Monitor              | Status
---------------------+---------------------
MySQL-Monitor        | Running
---------------------+---------------------
(7)查看服务 
MaxScale> list services
Services.
--------------------------+-------------------+--------+----------------+-------------------
Service Name              | Router Module     | #Users | Total Sessions | Backend databases
--------------------------+-------------------+--------+----------------+-------------------
Read-Only-Service         | readconnroute     |      2 |             20 | server2, server3, server4
Read-Write-Service        | readwritesplit    |      1 |             17 | server1
MaxAdmin-Service          | cli               |      2 |              2 | 
--------------------------+-------------------+--------+----------------+-------------------
(8)查看服务器节点 
MaxScale> list servers
Servers.
-------------------+-----------------+-------+-------------+--------------------
Server             | Address         | Port  | Connections | Status              
-------------------+-----------------+-------+-------------+--------------------
server1            | 192.168.1.11    |  3306 |           0 | Master, Running
server2            | 192.168.1.12    |  3306 |           1 | Slave, Running
server3            | 192.168.1.13    |  3306 |           0 | Slave, Running
server4            | 192.168.1.14    |  3306 |           0 | Slave, Running
-------------------+-----------------+-------+-------------+--------------------
(9)查看会话 
MaxScale> list sessions
-----------------+-----------------+----------------+--------------------------
Session          | Client          | Service        | State
-----------------+-----------------+----------------+--------------------------
41               | localhost       | MaxAdmin-Service | Session ready for routing
43               | ::ffff:192.168.1.12 | Read-Only-Service | Session ready for routing
-----------------+-----------------+----------------+--------------------------
(10)查看线程 
MaxScale> list threads
Polling Threads.

 ID | State      | #descriptors (curr) | #descriptors (tot)  |
----+------------+---------------------+---------------------+
  0 | Processing |                   4 |                  76 |
MaxScale> 

4.总结 

maxscale 的命令:show,list 可以查看 maxscale的详细信息。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值