MySQL Production Issues
591 FOLLOWERS
MySQL Production Issues is a Blog which helps MySQL dba and others who are willing to learn MySQL administration.
MySQL Production Issues
4y ago
Backup of Database is the pillar of our system which is necessary and mandatory to provide us data incase of crash, new machine provisioning and many other scenarios listed here.
As part of the backup process, a snapshot is taken, and the data is transferred to the Recovery Services vault with no impact on production workloads. The snapshot provides different levels of consistency, as described below:
1. Application-consistent: App-consistent backups capture memory content and pending I/O operations. App-consistent snapshots use a VSS writer (or pre/post scripts for Linux) to ensure ..read more
MySQL Production Issues
4y ago
Recently we have setup Orchestrator in High Availability mode using RAFT. We are running a 3 node setup in which there used to be a leader and rest 2 are Healthy raft member.
So To access orchestrator service we may only speak to the leader node using /api/leader-check as HTTP health check for our proxy. This url returns http 200 on leader and 404 on members. So using below code in open nginx we have setup http health check with basic auth.
Prerequisite: Lua support should be enabled in nginx.
Below code is to define upstreams with healthcheck:
upstream orchestrator {
server 10.xx.x ..read more
MySQL Production Issues
4y ago
Today, I am going to tell very interesting use-case where we have used Blackhole engine as replication filter.
We have an Aurora Cluster(let's call it C1) where multiple db's are hosted and multiple applications are writing data into it. While in another project one application wanted to read the data from one of the db's hosted on aurora cluster C1 & this new project is hosted into another account.
Now the challenge is we don't want self hosted db which supports replication filters(replicate-do-db) and bring only one db while wanted to use aurora only to in the new project as p ..read more
MySQL Production Issues
5y ago
Today I am putting simple and straight forward steps to in-place upgrade / downgrade mongoDB single as well as replica set cluster.
Note: Steps are for CentOS kindly modify for other OS. Warning: IMPORTANT Always backup all of your data before upgrading MongoDB and test steps in nonprod env first.
1. Checking compatibility version
db.system.version.find();
2. setting compatiblity version
db.adminCommand( { setFeatureCompatibilityVersion: "3.4" } )
3. change dir
cd /tmp/
4. download pkgs (link)
wget https://repo.mongodb.org/yum/redhat/7/mongodb-org/3.6/x86_64/RPMS/mongodb ..read more
MySQL Production Issues
5y ago
As an improvement plan in DB Access you can introduce Redash in your company or to your clients. It is open source tool and can be hosted internally on private subnet.
Redash helps you making sense of your data. You can connect and query your data sources, build dashboards to visualize data and share them with your colleagues.
Some of redash features are: Write queries in their natural syntax and explore schemas
Live auto-complete and keyboard shortcuts
Create snippets for elements you frequently use
Use query results as data sources to join different databases
Redash support multiple i ..read more
MySQL Production Issues
5y ago
We all need a monitoring system like pmm to monitor our database. Let me give a brief about how pmm works.
So PMM uses prometheus to store metrics/graphs and grafana to display them. As seen in the architecture diagram prometheus uses consul to get the list of host to scrap metrics. More information on architecture and installation are available in docs.
We were facing issues related to down hosts and if setup alerts in grafana for down host and host is terminated it continuously throws alerts. So problem was how can we remove/deregister instances from pmm.
We can access consul UI using b ..read more
MySQL Production Issues
5y ago
Today I am going to explain ways to execute shell or bash commands from mysql clients or stored procedure and function. There are basically 2 method to do so:
Method 1: Use MySQL Client inbuilt feature
To run single command: \! command or system command. eg \! uptime or system command
To get terminal \! bash or \! sh
Method 2: Deploy external plugin (lib_mysqludf_sys)
Step 1: Download lib_mysqludf_sys from github: git clone https://github.com/mysqludf/lib_mysqludf_sys.git
Step 2: Install libmysqlclient15-dev, for Ubuntu you can use: apt-get install libmysqlclient15-dev
Step 3 ..read more
MySQL Production Issues
5y ago
There could be various requirements at application end which need realtime slaves. Let me introduce a solution to a problem we used to face how can we monitor whether our slaves are real time or they are lagging in Milliseconds. Unfortunately there is no built in feature in MySQL to get Replication Lag in MilliSeconds.
Perhaps there is a tool provisioned in pt-toolkit named as pt-heartbeat. It generates heartbeat events on master and monitoring system can monitor time difference on slave to calculate lag.
How to deploy pt-heartbeat in your environment (Assuming OS as UBUNTU xx.xx): St ..read more
MySQL Production Issues
5y ago
Most of us used to get errors like (Row not found, Duplicate row etc) on slave in Master slave replication and sometimes it is very difficult to find unsynced data and fix it while we know table name(s).
There are few recommended tools from percona to check replication integrity and fixed unsync data:
1. pt-table-checksum: performs an online replication consistency check by executing checksum queries on the master, which produces different results on replicas that are inconsistent with the master.
2. pt-table-sync: synchronizes data efficiently between MySQL tables.
Recommended ..read more
MySQL Production Issues
5y ago
Today I am going to introduce you all to an awesome tool GH-OST. We are using it since many months to Alter tables online. Believe me it saves lot of time and efforts while altering big tables in MySQL.
gh-ost has been developed at GitHub. To answer a problem we faced with ongoing, continuous production schema changes requiring modifications to MySQL tables. gh-ost changes the existing online table migration paradigm by providing a low impact, controllable, auditable, operations friendly solution.
gh-ost stands for GitHub’s Online Schema Transmogrifier/Transfigurator/Transformer/Thing ..read more