Monitor MySQL synchronization status using PythonMonitor MySQL synchronization status using Python
Using Python to monitor whether the MySQL database server is accessible and whether the master-slave synchronization is interrupted is very simple. Thanks to Python for bringin
. It doesn't matter if you have more permissions. You can only run them locally, as shown below:
grantallprivilegeson*.*to"yuhongchun"@"127.0.0.1"identifiedby"yuhongchun101";
grantallprivilegeson*.*to"yuhongchun"@"localhost"identifiedby"yuhongchun101";
Script design ideas:
1. This script should be able to adapt to a variety of different Intranet and Internet environments, that is, environments with different IP addresses;
2. Let the script also moni
This article describes how to monitor mysql master-slave replication using python to check MySQL master-slave replication,
Cur.exe cute ("show slave status;") cannot use cur.exe cute ("show slave status \ G ;")
Result = cur. fetchall ()
Returns a binary array.
Result [0] indicates the status of the show slave status when the result is returned.
Result [0] [n] re
Using pt-heartbeat to monitor the replication latency of MySQL, pt-heartbeatmysql
Pt-heartbeat
During database master-slave replication, whether the replication status and data delay are normal is a critical indicator. How can we monitor it?
Pt-heartbeat is a centralized tool developed by PERCONA to monitor replication
Monitoring host 192.168.24.69, the following with a for the monitored host 192.168.24.79, the following with the B ID remember to import monitoring MySQL templates files in the a server cacti 1. Install Snmp#yum installed on B net-snmp#vi/etc/snmp/snmpd.conf change the following section to start the SNMPD service and join the boot task #service snmpd start#chkconfig snmpd on 2. In MySQL b to perform assigne
First, get the total number of processes under MySQL user
Ps-ef | awk ' {print $} ' | grep "MySQL" | Grep-v "grep" | Wc-1
Second, host performance status
# uptime
[root@ ~]# Uptime
13:05:52 up, Min, 1 user, Load average:0.00, 0.00, 0.00
Third, CPU utilization rate
# Top
Or
# Vmstat
Four, disk IO volume
# Vmstat or # Iostat
Five, swap volume [memory]
# free
Six, database performance status
(1)
Tags: monitor mysql master-slave synchronization status is abnormalPhase 1: Develop a daemon script to detect every 30 seconds.Phase 2: If the following error number (1158,1159,1008,1007,1062) appears in sync, skip the errorPhase 3: Use array technology to implement the above script (get master-slave judgment and error number section)[[emailprotected]~]#mysql-uro
MySQL allows the storage results to be paged out for complex queries.
It seems that there are few people talking about paging, are we all addicted to limit m,n?In the case of an index, the limit m,n speed is sufficient, but when searching for complex conditions,where somthing ORDER by Somefield+somefieldMySQL searches through the database, finds "All" eligible records, and then takes out M,n records.If you
Here to monitor memory usage as an example, write a simple demo program, the specific operation according to the 51reboot provided by the tutorial written as follows.
First, build a database to build a table
To create a Falcon database:
Mysql> CREATE DATABASE Falcon character set UTF8; Query OK, 1 row Affected (0.00 sec)
To create a memory monitor using the ta
Monitor MySQLProbably logicalThere's a library where we get the ports for all the libraries,There's a table that records the IP address ports and roles for each database.Some databases are both the main library and the library (not the actual slave, but the read and write are on this, so the table is also recorded as slave)To get the data from the sun, that is, the main library and from the library as a primary library to come and go to
Tags: des using mysq development col run BSH temporary from Why should I use a small table to drive a large table1, the definition of the driver tableWhen a multi-table join query is made, [driver table] is defined as:1) When a join condition is specified, a table with fewer records rows that meet the query criteria is [driver table]2) when no join condition is specified, the table with the less number of rows is [driver table] (important!)Advice: If you don't know who to make the driver table,
saving accuracy is not accurate2. If the insertion is two decimal places, and the accuracy is two bits, then the number of inserts by the same will not be sure to find out3. For queries of three decimal places, ibid.So in MySQL numeric type, float is imprecise, try to avoid using, can use double or decimal, the difference is double is floating point calculation, decimal is fixed point calculation, will get
Label:In the previous blog in succession to record the query efficiency of the article. Today in the collation, write some of their own notes are as follows:Common reasons for slow queries are as follows:1. No index or index is not used.PS: Indexes are used to quickly look for records with specific values, and all MySQL indexes are saved as B-trees. If there is no index,
This article mainly describes the memory usage when MySQL returns a large number of results in PHP based on principles, manuals, and source code analysis. it also involves the use of MySQLCAPI. yesterday, a colleague mentioned in the PHP discussion group that a project he created had too many results (up to 0.1 million results) returned by MySQL queries, resultin
This article mainly describes the memory usage when MySQL returns a large number of results in PHP based on principles, manuals, and source code analysis. it also involves the use of MySQLCAPI. yesterday, a colleague mentioned in the PHP discussion group that a project he created had too many results (up to 0.1 million results) returned by MySQL queries, resultin
of the rows, when MySQL generally does a full table scan, but in some cases the index is used (related to IPART).
L If you use LIMIT n with ORDER by, after MySQL finds the first qualifying record, it ends the sort instead of sorting the entire table.
When LIMIT N and DISTINCT are used simultaneously, MySQL will stop querying after a record is found.
In some case
of the rows, when MySQL generally does a full table scan, but in some cases the index is used (related to IPART).
L If you use LIMIT n with ORDER by, after MySQL finds the first qualifying record, it ends the sort instead of sorting the entire table.
When LIMIT N and DISTINCT are used simultaneously, MySQL will stop querying after a record is found.
In some case
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.