Saturday, May 20, 2023

Now I know why zoom feature is available in operating system for.

I use to think why would an O/S feature is created as it sudden zoom ridiculous 10-100x of the current resolution. 

But as one age, it FINALLY make sense, all comes around! Let's give an example. Given the current view at current resolution of the following picture

Given the following webshot, what's the difference can you identify?

Sure, some with very good eye can spot but it would also take sometime to identify. But if you can zoom in, wouldn't that be nice?! In linux , try super + alt + 8, yes the 8 is not on the numpad. Now it should be clearly shown what is the difference.

The display might be too small, try open the image in a new window tab. It should be clearly seen that the vertical line is dashed whilst the horizontal line is dotted. Well that's the difference!

It is like the zoom feature allow one to inspect the DNA.. well, computer DNA.. :) 

Tuesday, March 7, 2023

how to setup mariadb galera cluster in docker container

 1. create network (one time)

   docker network create --subnet= mynet123

2. create image that can start service in container (one time)

   mkdir systemd

   cd systemd

   vim Dockerfile

   FROM almalinux

   ENV container docker

   RUN (cd /lib/systemd/system/; for i in ; do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done);

   RUN rm -rf /lib/systemd/system/ \

   && rm -rf /etc/systemd/system/.wants/ \

   && rm -rf /lib/systemd/system/ \

   && rm -f /lib/systemd/system/ \

   && rm -f /lib/systemd/system/ \

   && rm -rf /lib/systemd/system/ \

   && rm -f /lib/systemd/system/*

   VOLUME [ “/sys/fs/cgroup” ]

   CMD ["/usr/sbin/init"]

3. build image (one time)

   docker build -t almalinux-md .

4. start the container in the background

   docker run -v /tmp/node1/:/var/lib/mysql --detach --rm -it --privileged --net mynet123 --ip --name node1  almalinux-md 

   docker run -v /tmp/node2/:/var/lib/mysql --detach --rm -it --privileged --net mynet123 --ip --name node2  almalinux-md

   docker run -v /tmp/node3/:/var/lib/mysql --detach --rm -it --privileged --net mynet123 --ip --name node3  almalinux-md  

5. attach it and so can install mariadb and gelera, etc

   docker exec -it node1 bash

   docker exec -it node2 bash

   docker exec -it node3 bash

6. install in all 3 nodes

   dnf install -y mariadb-server.x86_64  mariadb.x86_64 rsync python3-policycoreutils vim nc telnet epel-release.noarch mariadb-server-galera.x86_64

7. on first node

   systemctl start mariadb

   systemctl status mariadb

   [root@6c3d7f5bc394 /]# mysql -uroot

   MariaDB [(none)]> set password = password("password");


   systemctl stop mariadb


8. from step 5. wsrep_node_address and wsrep_node_name update to its corresponding name   

   [root@cfeee129fe92 /]# cat /etc/my.cnf.d/galera.cnf






   # Galera Provider Configuration



   # Galera Cluster Configuration



   # Galera Synchronization Configuration


   # Galera Node Configuration



   [root@cfeee129fe92 /]# 

9.  on first node, start the cluster



10. check on the first node,

    mysql -u root -ppassword -e "SHOW STATUS LIKE 'wsrep_cluster_size'"   


11. bring up the remaining nodes one by one

    systemctl start mariadb

    mysql -u root -ppassword -e "SHOW STATUS LIKE 'wsrep_cluster_size'"   

12. ready to write/read

mysql -u root -ppassword -e 'CREATE DATABASE playground;


INSERT INTO (type, quant, color) VALUES ("slide", 2, "blue");'

mysql -u root -ppassword -e 'SELECT * FROM;'