Software

GitLab Runner 安裝及設定

依照官方的方式有很多種,使用的是比較簡單的 packages 安裝 1 安裝時執行 Repository curl -L "https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.deb.sh" | sudo bash 2 安裝最新版的 git runner sudo apt-get install gitlab-runner 4 註冊/設定 runners sudo gitlab-runner register #輸入 gitlab 的 url Enter the GitLab instance URL (for example, https://gitlab.com/): #輸入 gitlab 的 token Enter the registration token: #對這個 runner 的描述 Enter a description for the runner: …

Continue Reading
Software

Cannot update GTID_PURGED with the Group Replication plugin running

今天將 GR 的資料做 mysqldump 的時候發生了這樣子的警告訊息,然後在匯入到新環境的時候就發生了錯誤 Warning: A partial dump from a server that has GTIDs will by default include the GTIDs of all transactions, even those that changed suppressed parts of the database. If you don't want to restore GTIDs, pass –set-gtid-purged=OFF. To make a complete dump, pass –all-databases –triggers –routines –events. 主要是因為 MGR 狀態的時候會啟動 …

Continue Reading
Software

清理 mysql binlog

繼上一篇的 GCP 硬碟炸掉的文章裡面發現主要讓他滿出來的問題主是因為 MySQL Binlog 的問題,所以就算是把空間擴大了但是主要還是要移除過期的 Binlog 才可以 一般來說 BingLog 有兩個很大的用途 資料恢復 Binlog 記錄了所有的 SQL 動作,所以如果 binlog 完整了話就有可以恢復到某個指定的時間點。 主從複製 從屬 DB 會去訂閱 binlog 的動作然後進而產生資料庫同步的效果 但是有時候過多的 binlog 會造成硬碟的負擔,使用下面的語句可以指定保留幾天內的 binglog PURGE MASTER LOGS BEFORE DATE_SUB(CURRENT_DATE, INTERVAL 3 DAY); 或是在 my.cnf 裡面加上 #只保留三天的 bin log expire_logs_days=3 基本上這種清 bin log 的機制不管是手動還是自動最好還是有一個機制會比較恰當 例如輸出備份後刪除,因為 bin log 用途很廣泛,所以盡可能的保留下來

Continue Reading
Software

OSError: [Errno 28] No space left on device

突然有一天早上發現 GCP 上面有台 CE 無法開機 經過 Serial port 的查詢出現了 OSError: [Errno 28] No space left on device 的訊息 查了一下應該是硬碟空間不足造成了 解法就是擴充現在有硬碟空間 但是問題來了,沒辦法 SSH 進去所以只能使用另外一台機器掛載上去後再擴充然後再掛回去 以下是擴充的指令 確認磁碟編號 sudo fdisk -l ### 出現了剛剛擴充的空間,但是還沒分配 GPT PMBR size mismatch (62914559 != 268435455) will be corrected by write. The backup GPT table is not on the end of the device. This …

Continue Reading
Software

MySQLRouter

1.架構確認 mysql router : 實踐單一路口多節點分流或讀寫分離 2.建立主機 192.168.1.60 myrouter innodb cluster 192.168.1.61 innodb-node1 192.168.1.62 innodb-node2 192.168.1.63 innodb-node3 3.環境準備 3.1 安裝 mysql router 匯入官方的 mysql apt repository https://dev.mysql.com/downloads/repo/apt/ wget https://dev.mysql.com/get/mysql-apt-config_0.8.22-1_all.deb && \ sudo dpkg -i ./mysql-apt-config_0.8.22-1_all.deb && \ sudo apt update && \ sudo apt install -y mysql-router 3.2 建立 router sudo mysqlrouter –bootstrap root@innodb-node1:3306 -d myrouter …

Continue Reading
Software

mysql cluster MGR 建立

1.架構確認 innodb cluster 基本架構如下 innodb-node (Primary) : innodb 架構主節點,通常也會是 R/W 節點 innodb-node (Secondary) : innodb 的抄寫節點,通常可以做為 R/O 的節點 innodb-node (Secondary) : innodb 的抄寫節點,通常可以做為 R/O 的節點 2.建立主機 192.168.1.61 innodb-node1 192.168.1.62 innodb-node2 192.168.1.63 innodb-node3 3.環境準備 3.1. MySQL sudo apt install mysql-server 3.2. 設定 my.con sudo vi /etc/mysql/my.cnf my.cnf內容 [mysqld] #當前 Node 的 ID 不得重複 server-id=61 gtid_mode=on enforce_gtid_consistency=on …

Continue Reading
Software

mysql cluster NDB 建立

1.架構確認 mysql cluster 基本架構如下 MySQL data nodes (ndbd) : 為 SQL Node 資料交換角色,同時會進行相互同步抄寫 Cluster Manager (ndb_mgmd) : 負責整個Cluster 集群中各個節點的管理工作, MySQL server/client (mysqld) : 主要為接收/傳遞對外接口角色,由 AP Service 連結 2.建立主機 198.168.1.61 ndb_mgmd 198.168.1.62 ndbd01 198.168.1.63 ndbd02 198.168.1.64 mysqld01 如遇到需要下載部分請按照需求版本更動 這裡的 OS 跟 DB 的版本分別是 OS: ubuntu 20.04 mysql-cluster: 8.0.28 可由這邊查詢連結 https://dev.mysql.com/downloads/cluster/ 3.安裝 ndb_mgmd #下載 ndb_mgmd wget https://dev.mysql.com/get/Downloads/MySQL-Cluster-8.0/mysql-cluster-community-management-server_8.0.28-1ubuntu20.04_amd64.deb …

Continue Reading
Software

推送至私有 Registry

上一章已經建立好了私有的 Registry 這一章則要來實作建立 image 然後推送 1. 建立一個 image #docker build -t web:1.0 . 參數說明: buile : 利用 Dockerfile 建立一個 image -t : 針對這個 image 命名,前面是名字後面是 Tag . : Dockerfile 的位置 2. 標記已建立的 image #docker tag web:1.0 127.0.0.1:5000/test:1.0 #docker images REPOSITORY TAG IMAGE ID CREATED SIZE 127.0.0.1:5000/test 1.0 c805ef25f0f3 20 hours ago 489MB web 1.0 c805ef25f0f3 …

Continue Reading
Software

使用官方 docker image 架設私有 Docker Registry

使用官方 docker image 架設私有 Docker Registry 1. 先進官方的 hub 確認 registry #docker search registry NAME DESCRIPTION STARS OFFICIAL AUTOMATED registry The Docker Registry 2.0 implementation for s… 3496 [OK] distribution/registry WARNING: NOT the registry official image!!! … 57 [OK] stefanscherer/registry-windows Containerized docker registry for Windows Se… 33 jc21/registry-ui A nice web interface for managing your …

Continue Reading
Software

MySql 8.0 Loading local data is disabled

之前寫的一隻 python 腳本在 MySQL 升級 8.0 之後發現出現了一個錯誤 Loading local data is disabled; this must be enabled on both the client and server sides 後來查的結果是 8.0 預設將 local data 的權限關閉了,查了一些資料大部分都說要使用 SET GLOBAL local_infile=1; 將 local_infile 的 Value 改成 on,不˙過後來修改過後還是出現同樣的訊息 修改前 修改後 後來又看到了一篇說要將 my.cnf 上 本來以為這樣沒問題了…結果還是跳出一樣的訊息後來再查了一下發現除了 Server 以外 client 也要加如果使用 mysql cli 了話就是 mysql -h xxx.xxx.xxx.xxx –local-infile=1如果是 …

Continue Reading