#CHECK DB SIZE:
postgres=# select t1.datname AS db_name,pg_size_pretty(pg_database_size(t1.datname)) as db_size from pg_database t1 order by pg_database_size(t1.datname) desc;
Steps:
A/ FULL BACKUP a DATABASE
A.1/ Backup Full Single Database
A.2/ Backup Schema of Single Database
B/ FULL RESTORE a DATABASE
B.1/ Create new empty Database <New DBName>
B.2/ Import Schema (A.2) to new Empty Database
B.3/ Discard Tablespace
B.4/ Copy all file of Backuped Database (A.1) to new Database
B.5/ chown -R mysql.mysql /opt/mariadb/data/<New DBName>
B.6/ Import Tablespace for all new Table
B.7/ DONE
P.S:
1/ Backup full a MariaDB/MySQL Database in Binary mode
2/ Backup full all MariaDB/MySQL Database in Binary mode
3/ Backup Incremental a or all database in Binary mode
4/ Restore full a or all database in Binary mode
For detail script, contact to me
#A/ Upgrade "Ubuntu 16.04.LTS.x64" to "Ubuntu 18.04.LTS.x64"
sudo apt-get update -y && sudo apt-get upgrade -y && sudo apt-get dist-upgrade -y && sudo do-release-upgrade
#B/Upgrade Ubuntu 16.04 -> 18.04, Fix lỗi ERROR Curl_Open_SSL cho PHP:
sudo apt-get -y remove --auto-remove libcurl4-openssl-dev && sudo apt-get -y install libcurl3
#C/ Fixed "LetsEncrypt Error":
sudo apt-get -y install libgnutls-openssl27 libgnutls30 ubuntu-advantage-tools
#D/REBOOT OS
#E/ Result: DONE
for var01 in {1..1000}doecho "Welcome $var01 times"doneDO$do$BEGINFOR i IN 1..25 LOOP-- COMMANDEND LOOP;END$do$;
In case you are told it isn’t possible, I can confirm that it is in fact possible to load balance requests to databases using HAProxy. Here are the specifics.
First, the databases in question are SQL 2012 Web Edition databases. They get populated by replication from a SQL 2012 Standard Edition publisher. Reads are sent to these replicated databases, but all writes go to the master database.
Here is the entire HAProxy config for a basic database load balancing listener, taking connections from a list of approved addresses and distributing them to three servers, depending on whether they appear to be up.
listen sql-db
bind *:1433
mode tcp
balance leastconn
acl db_white_list src 0.0.0.0 1.1.1.1 2.2.2.2 3.3.3.3
tcp-request connection reject if !db_white_list
option log-health-checks
server DB-1 4.4.4.1:1433 check port 1433 inter 1000
server DB-2 4.4.4.2:1433 check port 1433 inter 1000
server DB-3 4.4.4.3:1433 check port 1433 inter 1000
You can get more advanced here – you could perform more advanced checks using SQL to make sure you have more than just a connection to a port – but you get the idea.
What does this cost?
Unlike HTTP load balancing, you will actually start to see CPU usage on your HAProxy server. You will also see a big jump in network traffic, as web pages are usually smaller than the data you might query to generate them. You’ll need to make sure this isn’t a major problem. You’ll also see a little latency as it will take slightly longer to get your data as there is something else in the middle.