易陆发现互联网技术论坛

 找回密码
 开始注册
查看: 2|回复: 2
收起左侧

drbdadm 执行connect 报错信息terminated with exit code 10

[复制链接]
发表于 2023-12-22 01:11:31 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?开始注册

x
drbdadm connect all
- I9 s$ @. b7 W, m0 kimage: Failure: (102) Local address(port) already in use.
2 v; X6 @* u6 x* V& ?- `# ~, rCommand 'drbdsetup-84 connect image ipv4:10.29.114.236:7799 ipv4:10.29.114.235:7799 --protocol=C --cram-hmac-alg=sha1 --shared-secret=q123' terminated with exit code 10
6 ?5 S9 E; f0 m: O, a  v# Kmysql: Failure: (102) Local address(port) already in use.8 C2 `! C5 K; f# f0 k$ I2 h
Command 'drbdsetup-84 connect mysql ipv4:10.29.114.236:7789 ipv4:10.29.114.235:7789 --protocol=C --cram-hmac-alg=sha1 --shared-secret=q123' terminated with exit code 10
8 ~2 }. b/ O* r- b) _- L# X% O4 C* M1 V: j( m
drbdadm -- --discard-my-data connect all
+ D9 P7 a4 a/ X& simage: Failure: (102) Local address(port) already in use.# R& G7 Z$ x" p7 _7 J2 Z; _
Command 'drbdsetup-84 connect image ipv4:10.29.114.236:7799 ipv4:10.29.114.235:7799 --protocol=C --cram-hmac-alg=sha1 --shared-secret=q123 --discard-my-data' terminated with exit code 10
8 N- E: \9 P8 ~0 U) U, u, c; |- ?, Vmysql: Failure: (102) Local address(port) already in use.
9 e, _: }* o# T. b; T4 g+ NCommand 'drbdsetup-84 connect mysql ipv4:10.29.114.236:7789 ipv4:10.29.114.235:7789 --protocol=C --cram-hmac-alg=sha1 --shared-secret=q123 --discard-my-data' terminated with exit code 10- w6 k, o5 Q& o9 b3 O- I

6 n2 f+ q9 p# @0 e% [1 @
1 f, D7 b* Z& j4 M0 h  R
 楼主| 发表于 2023-12-22 01:12:08 | 显示全部楼层
Added new hard disk and do partition on both nodes:
fdisk /dev/sdb
Then format partition:
mkfs.ext4 /dev/sdb
(Failed on node2, so removed it and added a new disk become /dev/sdc. Formated it.)
Follow official guide to config the basic resource on both nodes:
[color=var(--theme-link-color, var(--theme-secondary-400))]http://docs.linbit.com/docs/users-guide-8.4/p-build-install-configure/#ch-configure
Created /etc/drbd.d/r0.res on both nodes:
resource r0 {    protocol C;    on node1 {            device /dev/drbd0;            disk /dev/sdb;            address 192.168.0.1:7789;            meta-disk internal;    }    on node2 {            device /dev/drbd0;            disk /dev/sdc;            address 192.168.0.2:7789;            meta-disk internal;    }}
Edit iptables on both nodes:
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 7788 -j ACCEPTiptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 7799 -j ACCEPTservice iptables save
Initialize data on both nodes:
drbdadm create-md r0
All OK.
Put the resource up on both nodes: drbdadm up r0
node1:
Device '0' is configured!Command 'drbdmeta 0 v08 /dev/sdb internal apply-al' terminated with exit code 20
node2:
??: Failure: (162) Invalid configuration requestadditional info from kernel:minor exists in different resourceCommand 'drbdsetup-84 new-minor r0 0 0' terminated with exit code 10
Both of them happened issues.
Run cat /proc/drbd on both nodes:
node1:
version: 8.4.9-1 (api:1/proto:86-101)GIT-hash: 9976da086367a2476503ef7f6b13d4567327a280 build by akemi@Build64R7, 2016-12-04 01:08:48 0: cs:WFConnection ro:Primary/Unknown ds:UpToDate/DUnknown C r----s    ns:0 nr:0 dw:0 dr:912 al:8 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:f oos:2097052
node2:
version: 8.4.9-1 (api:1/proto:86-101)GIT-hash: 9976da086367a2476503ef7f6b13d4567327a280 build by akemi@Build64R7, 2016-12-04 01:08:48 0: cs:WFConnection ro:Secondary/Unknown ds:Diskless/DUnknown C r----s    ns:0 nr:0 dw:0 dr:0 al:8 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:f oos:0
Primary and Secondary unknown.
Run drbdadm connect all on node1:
r0: Failure: (125) Device has a net-config (use disconnect first)Command 'drbdsetup-84 connect r0 ipv4:192.168.0.1:7789 ipv4:192.168.0.2:7789 --protocol=C' terminated with exit code 10
Run drbdadm -- --discard-my-data connect all on node2:
r0: Failure: (102) Local address(port) already in use.Command 'drbdsetup-84 connect r0 ipv4:192.168.0.1:7789 ipv4:192.168.0.2:7789 --protocol=C --discard-my-data' terminated with exit code 10
What's wrong of using it?

Edit 1
After ran dd if=/dev/zero of=/dev/sdb(sdc) bs=1M oflag=direct status=progress on both nodes, they also can't ran drbdadm up r0 successfully:
node1No valid meta data foundCommand 'drbdmeta 0 v08 /dev/sdb internal apply-al' terminated with exit code 255node2??: Failure: (162) Invalid configuration requestadditional info from kernel:minor exists in different resourceCommand 'drbdsetup-84 new-minor r0 0 0' terminated with exit code 10
Edit 2
At this time, ran systemctl start brdb on both nodes, all of them got pending. Wait for a long time returned no result.
And ran lsblk -a now:
NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTsda           8:0    0   10G  0 disk├─sda1        8:1    0    1G  0 part /boot└─sda2        8:2    0    9G  0 part  ├─cl-root 253:0    0    8G  0 lvm  /  └─cl-swap 253:1    0    1G  0 lvm  [SWAP]sdb           8:32   0   16G  0 disksr0          11:0    1 1024M  0 romdrbd0       147:0    0    2G  0 disk
. X2 G3 b$ ]- ]' s, L: ^$ p
 楼主| 发表于 2023-12-22 01:12:39 | 显示全部楼层
You don't want to create the filesystem on your backing disks for DRBD (sdb and sdc); you want to create the DRBD first, and then format the resulting DRBD device with your filesystem. It can be done the other way, but then you'd need to grow the backing partition, or reduce the size of the filesystem to make room for DRBD's metadata (which lives at the end of the block device when using internal metadata).' }9 t: h+ o, x2 V! @' ?
$ |, K# f$ P$ M) \
The process should be something like this:
* Q/ C3 ]- M2 v7 f; a; c. H# p" t4 k
-Install all your software like you have done above.- h9 P3 ~; \3 D

5 O9 W. a! y, s& T) @$ |( J-Zero out your partition on both nodes (optional, but do it):
8 d* z* Z# k- s: A, W/ x. z
2 j. k) g* O. I1 B8 A# dd if=/dev/zero of=/dev/sdb bs=1M oflag=direct status=progress
& _) y; _# h# ^; W& \8 ?& R# dd if=/dev/zero of=/dev/sdc bs=1M oflag=direct status=progress# k3 W! h, S( i: T
-Create the configuration file for your DRBD resources like you have done above.( R$ K) J( g1 M% n

3 V8 e( p# B! ?" U( ^* T-Add the firewall rules like you've done above (except you don't really need the port 7799, as that's not used in your configuration).; Y0 M$ i1 t/ q6 w" j

) Y  A0 |2 b$ k" b% y4 l% o1 p0 S-Create DRBD's metadata on the backing block devices, and bring up r0 on both nodes:
3 I9 n0 B0 c( m. e" j1 F4 _! N' H# M) I; P0 [
# drbdadm create-md r0' k% G( H8 }" u3 E8 _7 x. {
# drbdadm up r0, [- x4 E( |$ a  r2 L& {8 t
# cat /proc/drbd: K4 ?* l4 h& D9 _# w. e
-Check the output of cat /proc/drbd, you should see your device is Connected, Secondary/Secondary, and Inconsistent/Inconsistent. If any of those things are NOT true, STOP, something isn't right.8 [! H1 E) v) J: g6 e$ y0 x8 z
6 w2 I4 o. w! U& M
-Then, pick either node (NOT BOTH), force it to be primary (DRBD will not let you go primary on a node with Inconsistent data) and create the FS:% C1 p& V6 F0 d5 g4 d
% E6 ~# M- `, E  G' C9 S5 P* |4 e
# drbdadm primary r0 --force: }; i; z1 s" U
# mkfs.ext4 /dev/drbd09 W7 }2 v( g( z2 [0 P
Then you'd use /dev/drbd0 just like you would have used /dev/sda or /dev/sdc; don't touch /dev/sdb or /dev/sdc ever again unless you're confident in what you're doing. Touching DRBD's backing disks can introduce inconsistencies that DRBD will be unaware of (until you run a verify or otherwise overwrite the block).
, y! r* c- r9 d
( s( ~% ?+ K) N" lKeep reading LINBIT's documentation. DRBD is obviously a great tool, and is easy to use once you understand the basics, but you're dealing with storage so there is a lot of room to mess things up in a permanent way.
您需要登录后才可以回帖 登录 | 开始注册

本版积分规则

关闭

站长推荐上一条 /4 下一条

北京云银创陇科技有限公司以云计算运维,代码开发

QQ|返回首页|Archiver|小黑屋|易陆发现技术论坛 ( 蜀ICP备2026014127号-1 )点击这里给我发消息

GMT+8, 2026-4-9 00:04 , Processed in 0.041738 second(s), 23 queries .

Powered by Discuz! X3.4 Licensed

© 2012-2025 Discuz! Team.

快速回复 返回顶部 返回列表