How to monitor MariaDB Galera cluster status from command line
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
Related videos on Youtube
Michael
Updated on September 18, 2022Comments
-
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
-
Alexander about 3 yearsTry wrapping your loop body in an autorelease block developer.apple.com/documentation/objectivec/…
-
Michael about 3 years@Alexander Nice! That seems to work! But why is it necessary here?
-
Michael about 3 yearsLooks like everything is explained here: swiftrocks.com/autoreleasepool-in-2019-swift
-
Alexander about 3 yearsSummarized it all in an answer, for posterity
-
Kasiopeous almost 7 yearsAfter 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 almost 7 yearsThings might have change from the time I found the solution. Thanks for mentioning about the message.
-
inexcitus over 2 yearsI had the same issue. Thank you very much. Now my while loop uses 32MB of memory instead of 15 GB 😂