How to monitor MariaDB Galera cluster status from command line

329

After browsing the website http://www.fromdual.com/making-haproxy-high-available-for-mysql-galera-cluster , I found my own answer.

The answer to monitor Galera cluster status from command line is this command:

# mysql -u root -p<your_password> --exec="SHOW STATUS LIKE 'wsrep%';"

Example:

[root@mariadb01 ~]# mysql -u root -p<your_password> --exec="SHOW STATUS LIKE 'wsrep%';" |grep wsrep_local_state_comment
wsrep_local_state_comment       Synced
Share:
329

Related videos on Youtube

Michael
Author by

Michael

Updated on September 18, 2022

Comments

  • Michael
    Michael over 1 year

    I try to to read a file on macOS with Swift using class FileHandle and function

    @available(macOS 10.15.4, iOS 13.4, watchOS 6.2, tvOS 13.4, *)
    public func read(upToCount count: Int) throws -> Data?
    

    This works fine in principle. However, I'm faced with a memory leak. The data allocated in the returned Data buffer is not freed. Is this possibly a bug in the underlying Swift wrapper?

    Here is my test function, which reads a file block by block (and otherwise does nothing with the data). (Yes, I know, the function is stupid and has the sole purpose to prove the memory leak issue.)

    func readFullFile(filePath: String) throws {
        let blockSize = 32 * 1024
        guard let file = FileHandle(forReadingAtPath: filePath) else {
            fatalError("Failed to open file")
        }
        while (true) {
            guard let data = try file.read(upToCount: blockSize) else {
                break
            }
        }
    }
    

    If I call the function in a loop, and watch the program's memory consumption, I can see that the memory goes up in each loop step by the size of the read file and is never released.

    Can anybody confirm this behavior or knows how to fix it?

    My environment:

    • macOS 11.3.1 Big Sur
    • XCode 12.5

    Best, Michael

  • Kasiopeous
    Kasiopeous almost 7 years
    After running your example, I noticed the following message --> Info: Using unique option prefix 'exec' is error-prone and can break in the future. Please use the full name 'execute' instead. It might be better to use mysql -u root -p<your_password> --execute="SHOW STATUS LIKE 'wsrep%';"
  • Sharuzzaman Ahmat Raslan
    Sharuzzaman Ahmat Raslan almost 7 years
    Things might have change from the time I found the solution. Thanks for mentioning about the message.
  • inexcitus
    inexcitus over 2 years
    I had the same issue. Thank you very much. Now my while loop uses 32MB of memory instead of 15 GB 😂