Skip to content

Commit 10a8537

Browse files
committed
update document
1 parent 3849a34 commit 10a8537

File tree

3 files changed

+74
-60
lines changed

3 files changed

+74
-60
lines changed

AUTHORS

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,4 @@
44
# some cases, their employer may be the copyright holder. To see the full list
55
# of contributors, see the revision history in source control.
66

7-
Yamato Sugawara <[email protected]>
87
Shuichi Ohkubo <[email protected]>

docs/operation-guide.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ Sakura-DBCは、BGP経路のCommunity属性として表現することで、他
5252
Sakura-DBCを起動するには以下のようにコマンドを入力します。
5353

5454
```
55-
[root@test-db1 ~]# systemctl start db-controller
56-
[root@test-db1 ~]# systemctl status db-controller
55+
# systemctl start db-controller
56+
# systemctl status db-controller
5757
● db-controller.service - Database Controller
5858
Loaded: loaded (/etc/systemd/system/db-controller.service; enabled; vendor preset: disabled)
5959
Active: active (running) since Thu 2023-07-13 16:56:21 JST; 4s ago
@@ -70,8 +70,8 @@ Sakura-DBCを起動するには以下のようにコマンドを入力します
7070
Sakura-DBCを停止するには以下のようにコマンドを入力します。
7171

7272
```
73-
[root@test-db1 ~]# systemctl stop db-controller
74-
[root@test-db1 ~]# systemctl status db-controller
73+
# systemctl stop db-controller
74+
# systemctl status db-controller
7575
● sakura-controller.service - Database Controller
7676
Loaded: loaded (/etc/systemd/system/db-controller.service; enabled; vendor preset: disabled)
7777
Active: inactive (dead) since Thu 2023-07-13 16:55:35 JST; 7s ago
@@ -85,15 +85,15 @@ Sakura-DBCを停止するには以下のようにコマンドを入力します
8585
Sakura-DBCは、状態遷移や、それに伴い実行したコマンドなどをログ出力します。ログを確認するにはjournalctlコマンドを利用します。
8686

8787
```
88-
journalctl -u db-controller -e
88+
# journalctl -u db-controller -e
8989
```
9090

9191
## 現在の内部状態の確認方法
9292

9393
Sakura-DBCの現在の状態を確認するには、curlコマンドなどで以下のエンドポイントをHTTPリクエストします。
9494

9595
```
96-
[root@test-db1 ~]# curl http://127.0.0.1:54545/status
96+
# curl http://127.0.0.1:54545/status
9797
{"state":"replica"}
9898
```
9999

@@ -103,7 +103,7 @@ Sakura-DBCがGSLBに対し、どのようにレスポンスを行っているか
103103

104104
```
105105
! primaryの場合(200 OKが返る)
106-
[root@test-db2 ~]# curl -v http://127.0.0.1:54545/healthcheck
106+
# curl -v http://127.0.0.1:54545/healthcheck
107107
* Connected to 127.0.0.1 (127.0.0.1) port 54545 (#0)
108108
> GET /healthcheck HTTP/1.1
109109
> Host: 127.0.0.1:54545
@@ -113,7 +113,7 @@ Sakura-DBCがGSLBに対し、どのようにレスポンスを行っているか
113113
< Content-Length: 0
114114
115115
! primary以外の場合(503 Service Unavailableが返る)
116-
[root@test-db1 ~]# curl -v http://127.0.0.1:54545/healthcheck
116+
# curl -v http://127.0.0.1:54545/healthcheck
117117
* Connected to 127.0.0.1 (127.0.0.1) port 54545 (#0)
118118
> GET /healthcheck HTTP/1.1
119119
> Host: 127.0.0.1:54545
@@ -208,7 +208,7 @@ BGP経路情報を確認するには、以下のようにgobgpコマンドを用
208208
もし、ログレベルを変更するには、以下のようにします。
209209

210210
```
211-
vi /etc/systemd/system/db-controller.service
211+
# vi /etc/systemd/system/db-controller.service
212212
213213
! ログレベルを変更します(debugに変更する場合)
214214
ExecStart = /root/distributed-mariadb-controller/bin/db-controller --log-level debug ...
@@ -217,8 +217,8 @@ ExecStart = /root/distributed-mariadb-controller/bin/db-controller --log-level d
217217
systemdに反映し、db-controllerを再起動します。
218218

219219
```
220-
systemctl daemon-reload
221-
systemctl restart db-controller
220+
# systemctl daemon-reload
221+
# systemctl restart db-controller
222222
```
223223

224224
指定可能なログレベルと、各レベルにおいて出力されるログの基準は以下の通りです。

docs/quick-start-guide.md

Lines changed: 63 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ GSLBについて
3131

3232
Sakura-DBCは、以下のコンポーネントを利用します。
3333

34-
| 利用するコンポーネント | 動作確認バージョン |
34+
| 利用するコンポーネント | 動作確認バージョン |
3535
| --------------------------------------- | ------------------ |
3636
| [go](https://go.dev/) | 1.24.1 |
37-
| [gobgp](https://github.com/osrg/gobgp) | v3.35.0 |
37+
| [gobgp](https://github.com/osrg/gobgp) | 3.35.0 |
3838
| [MariaDB](https://mariadb.org/) | 10.11.4 |
3939
| [FRRouting](https://frrouting.org/) | 8.5.2 |
40-
| nftables | 0.9.3 |
40+
| nftables | 1.0.4 |
4141

4242
注: nftablesは、Primaryとなるデータベースサーバのみが3306番ポートへの接続を受け付けるようにパケットフィルタルールを設定するために使用されます
4343

@@ -49,12 +49,12 @@ Sakura-DBCは、以下のコンポーネントを利用します。
4949

5050
- firewalldを停止し、nftableを有効化します
5151
```
52-
systemctl stop firewalld
53-
systemctl disable firewalld
52+
# systemctl stop firewalld
53+
# systemctl disable firewalld
5454
55-
nft add table ip filter
56-
nft list ruleset > /etc/sysconfig/nftables.conf
57-
systemctl enable nftables
55+
# nft add table ip filter
56+
# nft list ruleset > /etc/sysconfig/nftables.conf
57+
# systemctl enable nftables
5858
```
5959

6060
### 2. FRRoutingのセットアップ
@@ -63,11 +63,13 @@ Sakura-DBCは、以下のコンポーネントを利用します。
6363

6464
- FRRをインストールします
6565
```
66-
yum -y install https://rpm.frrouting.org/repo/frr-8-repo-1-0.el8.noarch.rpm
67-
yum -y install frr
66+
# yum -y install https://rpm.frrouting.org/repo/frr-8-repo-1-0.el8.noarch.rpm
67+
# yum -y install frr
6868
```
6969
- /etc/frr/daemons ファイルを作成します
7070
```
71+
# vi /etc/frr/daemons
72+
----
7173
bgpd=yes
7274
vtysh_enable=yes
7375
zebra_options=" -A 127.0.0.1 -s 90000000"
@@ -76,6 +78,8 @@ Sakura-DBCは、以下のコンポーネントを利用します。
7678
```
7779
- /etc/frr/frr.conf ファイルを作成します
7880
```
81+
# vi /etc/frr/frr.conf
82+
----
7983
hostname test-server 【自身のホスト名を記入】
8084
log syslog informational
8185
no ip forwarding
@@ -106,13 +110,12 @@ Sakura-DBCは、以下のコンポーネントを利用します。
106110
```
107111
- FRRを起動します
108112
```
109-
systemctl enable frr
110-
systemctl start frr
113+
# systemctl enable frr
114+
# systemctl start frr
111115
```
112116
- (DBサーバセットアップ後) BGPピアが上がり、経路情報が交換できていることを確認します
113117
```
114-
vtysh
115-
118+
# vtysh
116119
show ip bgp sum
117120
show ip bgp
118121
```
@@ -123,6 +126,8 @@ Sakura-DBCは、以下のコンポーネントを利用します。
123126

124127
- /etc/yum.repos.d/MariaDB.repo ファイルを作成します
125128
```
129+
# vi /etc/yum.repos.d/MariaDB.repo
130+
----
126131
[mariadb]
127132
name = MariaDB
128133
baseurl = https://rpm.mariadb.org/10.11/rhel/$releasever/$basearch
@@ -132,10 +137,12 @@ Sakura-DBCは、以下のコンポーネントを利用します。
132137
```
133138
- MariaDBをインストールします
134139
```
135-
yum -y install MariaDB-client MariaDB-common MariaDB-compat MariaDB-server MariaDB-shared
140+
# yum -y install MariaDB-client MariaDB-common MariaDB-compat MariaDB-server MariaDB-shared
136141
```
137142
- /etc/my.cnf ファイルを作成します
138143
```
144+
# vi /etc/my.cnf
145+
----
139146
[mariadb]
140147
141148
character_set_server = utf8mb4
@@ -162,49 +169,49 @@ Sakura-DBCは、以下のコンポーネントを利用します。
162169
```
163170
- 1号機でレプリケーション用ユーザのパスワードを生成します
164171
```
165-
openssl rand 1000 | tr -dc '0-9A-Za-z' | fold -w 31 | head -1 > /root/.db-replica-password
172+
# openssl rand 1000 | tr -dc '0-9A-Za-z' | fold -w 31 | head -1 > /root/.db-replica-password
166173
```
167174
- 生成したファイルを2号機にコピーします
168175
```
169-
scp /root/.db-replica-password [email protected]:
176+
# scp /root/.db-replica-password [email protected]:
170177
```
171178
- 1号機にてDBの初期設定をします
172179
```
173-
systemctl start mariadb
180+
# systemctl start mariadb
174181
175-
mysql -e "drop database if exists test"
176-
mysql -e "delete from mysql.global_priv where User=''"
177-
mysql -e "delete from mysql.global_priv where User='PUBLIC'"
178-
mysql -e "delete from mysql.db where Db='test' or Db='test\\_%'"
179-
mysql -e "delete from mysql.proxies_priv"
182+
# mysql -e "drop database if exists test"
183+
# mysql -e "delete from mysql.global_priv where User=''"
184+
# mysql -e "delete from mysql.global_priv where User='PUBLIC'"
185+
# mysql -e "delete from mysql.db where Db='test' or Db='test\\_%'"
186+
# mysql -e "delete from mysql.proxies_priv"
180187
181-
mysql -e "flush privileges"
188+
# mysql -e "flush privileges"
182189
183-
REPL_PW=$(cat ~/.db-replica-password)
184-
mysql -e "grant all on *.* to repl identified by '$REPL_PW'"
190+
# REPL_PW=$(cat ~/.db-replica-password)
191+
# mysql -e "grant all on *.* to repl identified by '$REPL_PW'"
185192
```
186193
- 2号機にて、レプリケーション設定をします
187194
```
188-
systemctl start mariadb
195+
# systemctl start mariadb
189196
190-
mysql -e "drop database if exists test"
197+
# mysql -e "drop database if exists test"
191198
192-
REMOTE_HOST=xx.xx.xx.xx 【1号機のIPアドレスを記入】
193-
PASSWORD=$(cat /root/.db-replica-password)
199+
# REMOTE_HOST=xx.xx.xx.xx 【1号機のIPアドレスを記入】
200+
# PASSWORD=$(cat /root/.db-replica-password)
194201
195-
mysqldump --all-databases --master-data=1 --gtid --single-transaction -h $REMOTE_HOST -p$PASSWORD -u repl | mysql
202+
# mysqldump --all-databases --master-data=1 --gtid --single-transaction -h $REMOTE_HOST -p$PASSWORD -u repl | mysql
196203
197-
mysql -e 'flush privileges'
204+
# mysql -e 'flush privileges'
198205
199-
mysql -e "change master to master_host = '$REMOTE_HOST', master_user = 'repl', master_password = '$PASSWORD', master_use_gtid = slave_pos"
206+
# mysql -e "change master to master_host = '$REMOTE_HOST', master_user = 'repl', master_password = '$PASSWORD', master_use_gtid = slave_pos"
200207
201-
mysql -e 'reset master'
202-
mysql -e 'set global gtid_slave_pos=@@gtid_slave_pos'
208+
# mysql -e 'reset master'
209+
# mysql -e 'set global gtid_slave_pos=@@gtid_slave_pos'
203210
204-
mysql -e 'start replica'
211+
# mysql -e 'start replica'
205212
206-
# レプリケーションが確立したか確認
207-
mysql -e 'show replica status\G'
213+
! レプリケーションが確立したか確認
214+
# mysql -e 'show replica status\G'
208215
```
209216

210217
### 4. Sakura-DBCのセットアップ
@@ -213,20 +220,22 @@ Sakura-DBCは、以下のコンポーネントを利用します。
213220

214221
- golangをインストールします
215222
```
216-
wget https://go.dev/dl/go1.24.1.linux-amd64.tar.gz
217-
tar -C /usr/local -xzf go1.24.1.linux-amd64.tar.gz
218-
export PATH="$PATH:/usr/local/go/bin"
223+
# wget https://go.dev/dl/go1.24.1.linux-amd64.tar.gz
224+
# tar -C /usr/local -xzf go1.24.1.linux-amd64.tar.gz
225+
# export PATH="$PATH:/usr/local/go/bin"
219226
```
220227
- Sakura-DBCレポジトリをクローンし、コンパイルします
221228
```
222-
cd /root
223-
git clone https://github.com/sakura-internet/distributed-mariadb-controller.git
224-
cd distributed-mariadb-controller
225-
make all
229+
# cd /root
230+
# git clone https://github.com/sakura-internet/distributed-mariadb-controller.git
231+
# cd distributed-mariadb-controller
232+
# make all
226233
```
227234
注: コンパイルが成功すると、実行バイナリが `/root/distributed-mariadb-controller/bin/db-controller` に生成されます
228235
- /etc/systemd/system/db-controller.service ファイルを作成します
229236
```
237+
# vi /etc/systemd/system/db-controller.service
238+
----
230239
[Unit]
231240
Description=Database Controller
232241
After=network-online.target
@@ -241,12 +250,18 @@ Sakura-DBCは、以下のコンポーネントを利用します。
241250
```
242251
- systemdに反映させます
243252
```
244-
systemctl daemon-reload
253+
# systemctl daemon-reload
245254
```
246255
- db-controllerを始めに1号機、続いて2号機の順で起動します
247256
```
248-
systemctl enable db-controller
249-
systemctl start db-controller
257+
# systemctl enable db-controller
258+
# systemctl start db-controller
259+
```
260+
- gobgpをインストールします
261+
(db-controllerの動作上必要になるものではありませんが、CLIによりBGPの状態確認ができるためインストールを推奨します)
262+
```
263+
# wget https://github.com/osrg/gobgp/releases/download/v3.35.0/gobgp_3.35.0_linux_amd64.tar.gz
264+
# tar -C /usr/local/bin -xzf gobgp_3.35.0_linux_amd64.tar.gz
250265
```
251266

252267
### 5. GSLBのセットアップ

0 commit comments

Comments
 (0)