Error: I/O error while accessing persistent configuration storage

/etc/drbd.d/drbdctrl.resがない。対向ノードから引っ張ってくる。

# scp hoge@192.168.11.203:/etc/drbd.d/drbdctrl.res /etc/drbd.d/drbdctrl.res
# systemctl restart drbdmanaged
# drbdsetup status
.drbdctrl role:Secondary
  volume:0 disk:UpToDate
  volume:1 disk:UpToDate
  gitlab2 role:Secondary
    volume:0 peer-disk:UpToDate
    volume:1 peer-disk:UpToDate

ディスクを追加して論理ボリュームを作成

ディスクサイズ変更前の確認

vmwareから最初にcentosを入れた段階では20GBにしてた。

# fdisk -l

Disk /dev/sda: 21.5 GB, 21474836480 bytes, 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O サイズ (最小 / 推奨): 512 バイト / 512 バイト
Disk label type: dos
ディスク識別子: 0x000d8e85

デバイス ブート      始点        終点     ブロック   Id  システム
/dev/sda1   *        2048     1026047      512000   83  Linux
/dev/sda2         1026048    41943039    20458496   8e  Linux LVM

Disk /dev/mapper/centos-root: 18.8 GB, 18756927488 bytes, 36634624 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O サイズ (最小 / 推奨): 512 バイト / 512 バイト


Disk /dev/mapper/centos-swap: 2147 MB, 2147483648 bytes, 4194304 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O サイズ (最小 / 推奨): 512 バイト / 512 バイト
電源を切ってvmware側からディスクを追加

「仮想マシン設定の編集」→「ハードディスク(SCSI)」→「ディスクユーティリティ」→「拡張」→「ディスクの最大サイズ」を変更して「拡張」

30GBに拡張した。

ディスク容量変更後の確認
# fdisk -l

Disk /dev/sda: 32.2 GB, 32212254720 bytes, 62914560 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O サイズ (最小 / 推奨): 512 バイト / 512 バイト
Disk label type: dos
ディスク識別子: 0x000d8e85

デバイス ブート      始点        終点     ブロック   Id  システム
/dev/sda1   *        2048     1026047      512000   83  Linux
/dev/sda2         1026048    41943039    20458496   8e  Linux LVM

Disk /dev/mapper/centos-root: 18.8 GB, 18756927488 bytes, 36634624 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O サイズ (最小 / 推奨): 512 バイト / 512 バイト


Disk /dev/mapper/centos-swap: 2147 MB, 2147483648 bytes, 4194304 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O サイズ (最小 / 推奨): 512 バイト / 512 バイト
LVMの作成

m:マニュアルを表示
p:パーティションテーブルを表示
n:パーティションの追加
※パーティションの追加直後はLVMになってないのでパーティションのシステムIDを変更する
 「Hex code (type L to list all codes)」と訊かれたときに「L」押下で一覧が表示される。Linux LVMは「8e」
t:パーティションのシステムIDの変更
w:パーティションテーブルに変更を書き込み

# fdisk /dev/sda
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


コマンド (m でヘルプ): p

Disk /dev/sda: 32.2 GB, 32212254720 bytes, 62914560 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O サイズ (最小 / 推奨): 512 バイト / 512 バイト
Disk label type: dos
ディスク識別子: 0x000d8e85

デバイス ブート      始点        終点     ブロック   Id  システム
/dev/sda1   *        2048     1026047      512000   83  Linux
/dev/sda2         1026048    41943039    20458496   8e  Linux LVM

コマンド (m でヘルプ): n
Partition type:
   p   primary (2 primary, 0 extended, 2 free)
   e   extended
Select (default p): p
パーティション番号 (3,4, default 3): 3
最初 sector (41943040-62914559, 初期値 41943040): 
初期値 41943040 を使います
Last sector, +sectors or +size{K,M,G} (41943040-62914559, 初期値 62914559): 
初期値 62914559 を使います
Partition 3 of type Linux and of size 10 GiB is set

コマンド (m でヘルプ): t
パーティション番号 (1-3, default 3): 3
Hex code (type L to list all codes): 8e
Changed type of partition 'Linux' to 'Linux LVM'

コマンド (m でヘルプ): p   

Disk /dev/sda: 32.2 GB, 32212254720 bytes, 62914560 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O サイズ (最小 / 推奨): 512 バイト / 512 バイト
Disk label type: dos
ディスク識別子: 0x000d8e85

デバイス ブート      始点        終点     ブロック   Id  システム
/dev/sda1   *        2048     1026047      512000   83  Linux
/dev/sda2         1026048    41943039    20458496   8e  Linux LVM
/dev/sda3        41943040    62914559    10485760   8e  Linux LVM

コマンド (m でヘルプ): 
コマンド (m でヘルプ): w
パーティションテーブルは変更されました!

ioctl() を呼び出してパーティションテーブルを再読込みします。

WARNING: Re-reading the partition table failed with error 16: デバイスもしくはリソースがビジー状態です.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
ディスクを同期しています。
PVの作成
# pvcreate /dev/sdb3
  Device /dev/sdb3 not found (or ignored by filtering).

ファッ!?

# ls /dev/sda3
ls: /dev/sda3 にアクセスできません: そのようなファイルやディレクトリはありません

ファーーーーッ!???

# reboot
# ls /dev/sda3
/dev/sda3

リブートしたら見えた。

# pvcreate /dev/sda3
  Physical volume "/dev/sda3" successfully created
VGの作成

drbdを入れる予定なのでdrbdpoolを指定してる。

# vgcreate drbdpool /dev/sda3
  Volume group "drbdpool" successfully created

windows7でicmp許可

pingが通らないとき確認する。

コントロールパネル→Windowsファイアーウォール→詳細設定→受信の規則を開いて「ファイルとプリンターの共有(エコー要求)」を「規則を有効化」に設定する

drbd9インストール

# yum update
# yum install -y wget
# yum install -y libxslt pygobject2 help2man
# yum install -y kernel-headers
# reboot
#cd /tmp
# git clone --recursive git://git.drbd.org/drbd-9.0.git
# wget http://oss.linbit.com/drbd/drbd-utils-8.9.3.tar.gz
# git clone --recursive http://git.drbd.org/drbdmanage.git
# cd drbd-9.0
# make
# make install
# tar zxvf drbd-utils-8.9.3.tar.gz
# cd drbd-utils-8.9.3
# ./configure --prefix=/usr --localstatedir=/var --sysconfdir=/etc 
# make
# make install
# cd drbdmanage 
# make
# make install
(# systemctl start firewalld)
# firewall-cmd --add-port=6999/tcp --zone=public --permanent
# firewall-cmd --add-port=7000-7100/tcp --zone=public --permanent
# firewall-cmd --reload
(# systemctl stop firewalld)
片方のノードのみで実行

今回はホストネームがgitlab2、ipが192.168.12.203

# drbdmanage init 192.168.12.203

You are going to initialize a new drbdmanage cluster.
CAUTION! Note that:
  * Any previous drbdmanage cluster information may be removed
  * Any remaining resources managed by a previous drbdmanage installation
    that still exist on this system will no longer be managed by drbdmanage

Confirm:

  yes/no: yes
  Failed to find logical volume "drbdpool/.drbdctrl_0"
  Failed to find logical volume "drbdpool/.drbdctrl_1"
  Logical volume ".drbdctrl_0" created.
  Logical volume ".drbdctrl_1" created.
initializing activity log
NOT initializing bitmap
Writing meta data...
New drbd meta data block successfully created.
initializing activity log
NOT initializing bitmap
Writing meta data...
New drbd meta data block successfully created.
empty drbdmanage control volume initialized.
empty drbdmanage control volume initialized.
Operation completed successfully

# drbdmanage add-node gitlab1 192.168.12.202
Operation completed successfully
Operation completed successfully
Host key verification failed.

Join command for node gitlab1:
drbdmanage join -p 6999 192.168.12.202 1 gitlab2 192.168.12.203 0 XXXXXXXXXXXXXXXXXXXX
片方のノードのみで実行

今回はホストネームがgitlab1、ipが192.168.12.202

# drbdmanage join -p 6999 192.168.12.202 1 gitlab2 192.168.12.203 0 XXXXXXXXXXXXXXXXXXXX
You are going to join an existing drbdmanage cluster.
CAUTION! Note that:
  * Any previous drbdmanage cluster information may be removed
  * Any remaining resources managed by a previous drbdmanage installation
    that still exist on this system will no longer be managed by drbdmanage

Confirm:

  yes/no: yes
  Logical volume ".drbdctrl_0" successfully removed
  Logical volume ".drbdctrl_1" successfully removed
  Logical volume ".drbdctrl_0" created.
  Logical volume ".drbdctrl_1" created.
You want me to create a v09 style flexible-size internal meta data block.
There appears to be a v09 flexible-size internal meta data block
already in place on /dev/drbdpool/.drbdctrl_0 at byte offset 4190208

Do you really want to overwrite the existing meta-data?
*** confirmation forced via --force option ***
md_offset 4190208
al_offset 4157440
bm_offset 4153344

Found some data

 ==> This might destroy existing data! <==

Do you want to proceed?
*** confirmation forced via --force option ***
initializing activity log
NOT initializing bitmap
Writing meta data...
New drbd meta data block successfully created.
You want me to create a v09 style flexible-size internal meta data block.
There appears to be a v09 flexible-size internal meta data block
already in place on /dev/drbdpool/.drbdctrl_1 at byte offset 4190208

Do you really want to overwrite the existing meta-data?
*** confirmation forced via --force option ***
md_offset 4190208
al_offset 4157440
bm_offset 4153344

Found some data

 ==> This might destroy existing data! <==

Do you want to proceed?
*** confirmation forced via --force option ***
initializing activity log
NOT initializing bitmap
Writing meta data...
New drbd meta data block successfully created.
Operation completed successfully
# drbdsetup  status
.drbdctrl role:Secondary
  volume:0 disk:UpToDate
  volume:1 disk:UpToDate
  gitlab1 role:Secondary
    volume:0 peer-disk:UpToDate
    volume:1 peer-disk:UpToDate
ノードの状態確認

# drbdmanage n

| Name    | Pool Size | Pool Free |                                                                  | State |
| gitlab1 |     10236 |     10228 |                                                                  |    ok |
| gitlab2 |     10236 |     10228 |                                                                  |    ok |
リソース追加
# drbdmanage add-resource gitlab
Operation completed successfully
ボリューム追加
# drbdmanage add-volume gitlab 10000M
Operation completed successfully
リソースをデプロイ
# drbdmanage deploy-resource gitlab 2
Operation completed successfully
ノードの状態確認
# drbdmanage n
| Name    | Pool Size | Pool Free |                                                                  | State |
| gitlab1 |     10236 |       224 |                                                                  |    ok |
| gitlab2 |     10236 |       224 |                                                                  |    ok |
ファイルシステムの作成

※方ノードだけでいい

# mkfs -t ext4 /dev/drbd100
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
640848 inodes, 2560000 blocks
128000 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2151677952
79 block groups
32768 blocks per group, 32768 fragments per group
8112 inodes per group
Superblock backups stored on blocks: 
	32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done 
ノードの状態確認

全てのノードがセカンダリになっていることを確認
※mkfs直後はreplication:SyncSource peer-disk:Inconsistent done:XX.XXと表示されることがあるので、doneが100.00になるまで待つとpeer-disk:UpToDateに変わる。

# drbdsetup status
.drbdctrl role:Secondary
  volume:0 disk:UpToDate
  volume:1 disk:UpToDate
  gitlab1 role:Secondary
    volume:0 peer-disk:UpToDate
    volume:1 peer-disk:UpToDate

gitlab role:Secondary
  disk:UpToDate
  gitlab1 role:Secondary
    peer-disk:UpToDate
マウント先の作成

両方のノードで実行。

# mkdir -p /mnt/drbd/gitlab
マウント

片方のノードのみで実行。ここではgitlab2側で行った。
(もう片方でもマウントしようとすると不正なメディア云々と怒られる)

# mount /dev/drbd100 /mnt/drbd/gitlab/
ノードの状態確認

gitlab2側がプライマリになった。

# drbdsetup status
.drbdctrl role:Secondary
  volume:0 disk:UpToDate
  volume:1 disk:UpToDate
  gitlab1 role:Secondary
    volume:0 peer-disk:UpToDate
    volume:1 peer-disk:UpToDate

gitlab role:Primary
  disk:UpToDate
  gitlab1 role:Secondary
    peer-disk:UpToDate
ノードの状態確認

gitlab1側はセカンダリ。

# drbdsetup status
.drbdctrl role:Secondary
  volume:0 disk:UpToDate
  volume:1 disk:UpToDate
  gitlab2 role:Secondary
    volume:0 peer-disk:UpToDate
    volume:1 peer-disk:UpToDate

gitlab role:Secondary
  disk:UpToDate
  gitlab2 role:Primary
    peer-disk:UpToDate
冗長性の確認

・gitlab2側

# ls /mnt/drbd/gitlab
lost+found

・gitlab1側

# ls /mnt/drbd/gitlab
(何も見えない)

・gitlab2側
適当にファイルを作った後、アンマウント。
ロールがセカンダリになる。

# touch hoge
# ls /mnt/drbd/gitlab
hoge lost+found

# umount /mnt/drbd/gitlab
# drbdsetup status
.drbdctrl role:Secondary
  volume:0 disk:UpToDate
  volume:1 disk:UpToDate
  gitlab1 role:Secondary
    volume:0 peer-disk:UpToDate
    volume:1 peer-disk:UpToDate

gitlab role:Secondary
  disk:UpToDate
  gitlab1 role:Secondary
    peer-disk:UpToDate

・gitlab1側
gitlab2のアンマウント時点ではロールはセカンダリのままだが、gitlab1がマウントするとプライマリに昇格する。
gitlab2側で作成したファイルをgitlab1側でも見られるようになる。

# drbdsetup status
.drbdctrl role:Secondary
  volume:0 disk:UpToDate
  volume:1 disk:UpToDate
  gitlab2 role:Secondary
    volume:0 peer-disk:UpToDate
    volume:1 peer-disk:UpToDate

gitlab role:Secondary
  disk:UpToDate
  gitlab2 role:Secondary
    peer-disk:UpToDate

# mount /dev/drbd100 /mnt/drbd/gitlab/
# ls /mnt/drbd/gitlab/
hoge  lost+found

# drbdsetup status
.drbdctrl role:Secondary
  volume:0 disk:UpToDate
  volume:1 disk:UpToDate
  gitlab2 role:Secondary
    volume:0 peer-disk:UpToDate
    volume:1 peer-disk:UpToDate

gitlab role:Primary
  disk:UpToDate
  gitlab2 role:Secondary
    peer-disk:UpToDate

・gitlab2側
gitlab2側はセカンダリのまま。gitlab1がプライマリに昇格したことが確認できる。

# drbdsetup status
.drbdctrl role:Secondary
  volume:0 disk:UpToDate
  volume:1 disk:UpToDate
  gitlab1 role:Secondary
    volume:0 peer-disk:UpToDate
    volume:1 peer-disk:UpToDate

gitlab role:Secondary
  disk:UpToDate
  gitlab1 role:Primary
    peer-disk:UpToDate

cocos2dx3.2@Live2Dでポストエフェクト その3

炎エフェクトを作ってみた。
青エクとかがこういう感じのエフェクトだったような気がする。

やり方としては、火種にしたい部分を上にずらしながら描画して、
それをメタボールで削り、グレアで光らせている。
グレアで光らせずに黒系で塗り潰して、元画像を上から貼り付ければ
不機嫌なときのオーラの表現みたいなのもできそう。
延長線上で墨絵みたいなのもできるかも知れない。

それとフレーム内の背景がいくらなんでもひどすぎるので、
そろそろちゃんとした背景を自動生成できるようにしたい。
ここら辺はcocos2d-xの3D機能を使いたいなー、などと考えている。
コマ枠も付けないとだね