Docker Swarm + Portainer 筆記

原本打算用 Docker Swarm 玩下 mesh routing,點知伏位何其多。最伏嘅位係,佢寫就寫連到,但實際唔得,又無寫ERROR MSG。所以記錄一下點搞。

  1. Firewall / Router 開 Port
    TCP port 2377
    TCP and UDP port 7946
    UDP port 4789
  2. 揀一部機做 Manager, 行 docker swarm init –advertise-addr <ip> advertise-addr 非常重要,其他機必需要係連到呢個IP。假設你冇打 advertise-addr,咁 Docker 有機會拎咗你個 Lan IP (e.g. 192.168.1.2) 做地址。當你其他機唔係同一個 LAN 就會連唔到。
  3. init 完佢會俾個 command 你,唔好咁急行住喺其他 Worker 機行住,因為同樣地你都係要加 advertise-addr。
    docker swarm join –token <token> <manager ip>:2377 –advertise-addr <ip>
  4. 之後喺 Manager 就可以裝 Portainer。
    curl -L https://downloads.portainer.io/portainer-agent-stack.yml -o portainer-agent-stack.yml
    docker stack deploy -c portainer-agent-stack.yml portainer
  5. 如果想加多啲 Worker 重覆第3步即可。
  6. 之後可以喺 Portainer 加個 nginx service 試下係咪真係得 http://<manager ip>:9000/#!/1/docker/services/new
    Name: 你鍾意
    Image: nginx:latest
    Replicas: 1
    Port Mapping: 7000:80 (都係你鍾意,記得 Firewall 開返)
  7. 然後可以睇下得唔得,兩個都上到就代表 Mesh Routing 生效中,如果唔得,就要 Double Check 第一至第三步有冇做錯嘢。
    http://<manager ip>:7000
    http://<worker ip>:7000

CentOS cannot bootup after remove gnome

https://docs.bmc.com/docs/display/DISCO113/Booting+in+rescue+mode+on+CentOS+7

It stopped at “Started Update UTMP about System Runlevel Changes.”

Following the URL instruction and add this systemd.unit=multi-user.target

After login, change the default target using this command:
systemctl set-default multi-user.target

MariaDB Galera Cluster 筆記

原本 MySQL 加Cluster 的方法實在很麻煩,又要mysqldump又長downtime,仲要好難SET。今日無意中發現MariaDB Galera Cluster加入Cluster Node 係方便好多!

基本上跟住呢個教學做就OK
https://ahmermansoor.blogspot.com/2019/02/install-mariadb-galera-cluster-on-centos-7.html
( mysql_secure_installation 嗰一步唔使做 )

但有個卡關位係,因為本身個MariaDB 比較大,Cluster Node 開始Sync 嘅時候,多過1分30秒,systemd 當start fail!

解決方法係喺 /etc/systemd/system/mysqld.service, 喺 [Service] 下面加返 TimeoutStartSec = 60m

另外/etc/my.cnf 如果有啲特別設定,最好都複雜埋去啲 Cluster Node 。

仲有只支援 InnoDB,MyISAM 同步唔到新加的資料,要留意。

Install Windows 7 x86 on KVM VPS using dd

Support KVM only. OpenVZ is not supported.

  1. Backup your files on your VPS.
  2. Install CentOS on your VPS.
  3. Install these packages:
    yum install -y gawk sed grep glibc-common
  4. Install Windows by running the following command:
    wget --no-check-certificate -qO DebianNET.sh 'https://moeclub.org/attachment/LinuxShell/DebianNET.sh' && bash DebianNET.sh -dd 'https://moeclub.org/get-win7embx86-auto'

    It may takes up 40 to 90 mins, depends on your VPS. The ssh session will be closed. You cannot see the progress on the ssh.

  5. If your VPS provider supports VNC, you may see “Starting up the partitioner”. It is normal, just pay attend.
  6. After that, you can login to the Windows by RDP or VNC using this Windows Account:
    Username: Administrator
    Password: Vicer

     

(Source: https://moeclub.org)