Chuyển tới nội dung

Mariadb Galera Cluster

1. Install Mariadb Install dependencyapt-get install -y build-essential libgcrypt11-dev zlib1g-dev libxml2-dev libssl-dev  libncurses-dev git wget cmake gcc make tar libgd-dev libpcre3-dev bison scons libboost-dev libboost-program-options-dev openssl dh-autoreconf libssl-dev Download mariadbhttps://vn-mirrors.vhost.vn/mariadb/mariadb-11.8.2/source/mariadb-11.8.2.tar.gz Build Mariadb 2. Install galera wget https://archive.mariadb.org//mariadb-11.8.2/galera-26.4.22/src/galera-26.4.22.tar.gztar xvfz galera-26.4.22.tar.gzapt-get install check cmake libasio-dev libboost-dev libboost-program-options-dev libssl-devcd galera-26.4.22cmake .makecp libgalera_smm.so /usr/lib64/galera 3. Install scons wget http://prdownloads.sourceforge.net/scons/scons-2.5.0.tar.gztar xvfz scons-2.5.0.tar.gzcd scons-2.5.0/python setup.py install –prefix=/opt/scons 4. Cấu hình galera Thêm cấu hình vào file… Mariadb Galera Cluster

Các thuật ngữ thường dùng trong chiến lược backup database

1. Giới thiệu các thuật ngữ thường gặp khi backupBackup database là một trong các công việc quan trọng nhất của người quản trị CSDL (Database Administrator – DBA). Hẳn là khi backup database, bạn thường nghe đến các thuật ngữ sau:– Backup toàn bộ database (Full backup)– Backup một phần database (Partial backup)– Backup tăng tiến (Incremental backup)– Backup nhất quán dữ liệu (Consistent backup)– Backup không nhất quán… Các thuật ngữ thường dùng trong chiến lược backup database

Một số lệnh patroni và etcd cơ bản

PatroniKhởi tạo lại member patronipatronictl -c /etc/patroni.yml reinit postgres indo_psql1Loại bỏ 1 node ra khỏi clusterpatronictl -c /etc/patroni.yml remove indo_psql1Kiểm tra member listpatronictl -c /etc/patroni/patroni.yml listĐể Disable Patroni Cluster Auto Failoverpatronictl -c /etc/patroni/patroni.yml pausePatroni Cluster Switchoverpatronictl -c /etc/patroni/patroni.yml switchover –master node1 –candidate node2 etcdCheck etcd service logsjournalctl -u etcd.service -fKiểm tra danh sách member trong etcd clusteretcdctl member list -w tableLưu cặp key-value vào etcd clusteretcdctl put greeting “Hello World!”Kiểm… Một số lệnh patroni và etcd cơ bản

High Available Postgres by Patroni

Install Postges trên tất cả các node Tạo các user trên các nodesu postgres/opt/postgres/bin/psqlpostgres=# CREATE USER replicator WITH REPLICATION ENCRYPTED PASSWORD ‘x0hDfZv27’;postgres=# CREATE USER postgres WITH SUPERUSER ENCRYPTED PASSWORD ‘njk16uAeFNl’; Install watchdogsudo vi /etc/watchdog.conf## active dòng này lên, bỏ comment đi:watchdog-device = /dev/watchdog## thực hiện chuỗi lệnh bên dưới để active software watchdog sudo mknod /dev/watchdog c 10 130cat <<EOF >/etc/modules-load.d/softdog.confsoftdogEOF sudo modprobe softdogsudo chown postgres /dev/watchdogsystemctl restart watchdog Install… High Available Postgres by Patroni

Install Postgresql-16

https://www.manniwood.com/2023_12_07/postgresql_16_compile_install_howto.html https://www.tecmint.com/install-postgresql-from-source-code-in-linux echo “vm.nr_hugepages = 2048” >> /etc/sysctl.confsysctl -p Script install postgresql-16 Tạo các extension Cấu hình pg_hba.conf

Liên hệ