易陆发现互联网技术论坛

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

drbd错误总结 创建过程

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

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

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

x

[color=rgba(58, 58, 58, 0.88)]问题1、’ha’ ignored, since this host (node2.centos.bz) is not mentioned with an ‘on’ keyword.?

[color=rgba(58, 58, 58, 0.88)]错误信息:
: x4 \1 C  ^9 R7 j1 T; w执行指令 drbdadm create-md ha 时出现如下错误信息:
, b* A5 u. V& M5 z$ S: `‘ha’ ignored, since this host (node2.centos.bz) is not mentioned with an ‘on’ keyword.

[color=rgba(58, 58, 58, 0.88)]解决方法:
2 B9 z  m0 Y& G2 z/ X. c因为在 drbd 设定 drbd.conf 中 on 本来写的是 node1、node2 而以,将node1和node2分别改为node1.centos.bz,node2.centos.bz。

[color=rgba(58, 58, 58, 0.88)]问题2、drbdadm create-md ha: exited with coolpre 20?

[color=rgba(58, 58, 58, 0.88)]错误信息:+ n& T1 s' [4 r6 u/ I3 [6 Y4 h/ C
执行指令 drbdadm create-md ha 时出现如下错误信息:

[color=rgba(58, 58, 58, 0.88)]open(/dev/hdb1) failed: No such file or directory
8 I! _" q. @8 A, }Command ‘drbdmeta 0 v08 /dev/hdb1 internal create-md’ terminated with exit coolpre 205 `. o& }+ z, k3 N& u
drbdadm create-md ha: exited with coolpre 20

[color=rgba(58, 58, 58, 0.88)]解决方法:
, F& |; Q! L) @. a6 _0 p7 t因为忘了执行 fdisk /dev/hdb 指令建立分割区所造成,如下将 /dev/hdb 建立分割区后指令即可正常执行

  • # fdisk /dev/hdb //准备为 hdb 建立分割区
  • The number of cylinders for this disk is set to 20805.
  • There is nothing wrong with that, but this is larger than 1024,
  • and could in certain setups cause problems with:
  • 1) software that runs at boot time (e.g., old versions of LILO)
  • 2) booting and partitioning software from other OSs
  • (e.g., DOS FDISK, OS/2 FDISK)
  • Command (m for help): n //键入 n 表示要建立分割区
  • Command action
  • e extended
  • p primary partition (1-4)
  • p //键入 p 表示建立主要分割区
  • Partition number (1-4): 1 //键入 1 为此主要分割区代号
  • First cylinder (1-20805, default 1): //开始磁柱值,按下 enter 即可
  • Using default value 1
  • Last cylinder or +size or +sizeM or +sizeK (1-20805, default 20805): //结束磁柱值,按下 enter 即可
  • Using default value 20805
  • Command (m for help): w //键入 w 表示确定执行刚才设定
  • The partition table has been altered!
  • Calling ioctl() to re-read partition table.
  • Syncing disks.
    ; q8 X# r/ ~+ `" G. k

[color=rgba(58, 58, 58, 0.88)][root@node1 yum.repos.d]# partprobe //使刚才的 partition table 变更生效

[color=rgba(58, 58, 58, 0.88)]问题3、drbdadm create-md ha: exited with coolpre 40?

[color=rgba(58, 58, 58, 0.88)]错误信息:
; A  o6 S' e4 y0 u2 b& A执行指令 drbdadm create-md ha 时出现如下错误信息:

  • Device size would be truncated, which
  •   would corrupt data and result in
  •   'access beyond end of device' errors.
  •   You need to either
  •      * use external meta data (recommended)
  •      * shrink that filesystem first
  •      * zero out the device (destroy the filesystem)
  •   Operation refused.
  •   Command 'drbdmeta 0 v08 /dev/hdb1 internal create-md' terminated with exit coolpre 40
  •   drbdadm create-md ha: exited with coolpre 40/ M; c6 P( Q7 ~; d- n+ Y2 L

[color=rgba(58, 58, 58, 0.88)]解决方法:
+ b2 P, x' [2 k. K, ^1 D& q使用 dd 指令将一些资料塞到 /dev/hdb 后再执行 drbdadm create-md ha 指令即可顺利执行

[color=rgba(58, 58, 58, 0.88)]# dd if=/dev/zero of=/dev/hdb1 bs=1M count=100

[color=rgba(58, 58, 58, 0.88)]问题4、DRBD 状态始终是 Secondary/Unknown?

[color=rgba(58, 58, 58, 0.88)]错误信息:4 S8 I# r) v% e& k
Node1、Node2 主机启动 DRBD 后状态始终是 Secondary/Unknown

  • #service drbd status
  • drbd driver loaded OK; device status:
  • version: 8.3.8 (api:88/proto:86-94)
  • GIT-hash: d78846e52224fd00562f7c225bcc25b2d422321d build by mockbuild@builder10.centos.org, 2010-06-04 08:04:16
  • m:res cs ro ds p mounted fstype
  • 0:ha WFConnection Secondary/Unknown Inconsistent/DUnknown C
    3 _4 q0 o5 l+ J

[color=rgba(58, 58, 58, 0.88)]解决方法:  Z! r: W: j+ M; J
1、Node1、Node2 没有打开相对应的 Port,请开启相对应的 Port 或先把 IPTables 服务关闭即可。
; D0 ^% D: b2 _+ K5 T" M& t  w: p2、可能发生了脑裂行为,一般出现在ha切换时,解决方法:; e6 c7 e" Z+ n' _% X
在一节点执行:
/ S1 l) T/ y) ~' v' ]! P0 l* @drbdadm secondary resource
: X8 G9 B' o2 J% ^; z% rdrbdadm connect –discard-my-data resource' m1 t2 ]. B6 [- {) c8 G" u$ c+ n
另一节点执行:' ~' d$ H- T) r4 F& O5 D, Q
drbdadm connect resource

[color=rgba(58, 58, 58, 0.88)]问题5、1: Failure: (104) Can not open backing device

[color=rgba(58, 58, 58, 0.88)]错误信息:
7 r6 ]; n' \0 Q" S  I8 ?& g执行drbdadm up r0时出现:

[color=rgba(58, 58, 58, 0.88)]1: Failure: (104) Can not open backing device.
7 Y; U3 N! I9 D  k& V9 rCommand ‘drbdsetup attach 1 /dev/sdb1 /dev/sdb1 internal’ terminated with exit pre 10

[color=rgba(58, 58, 58, 0.88)]解决方法:
' L! L% U( I6 k" _可能因为你挂载了/dev/sdb1,执行umount /dev/sdb1即可。

2 E+ S4 M  I+ O- {* d5 ^

& \: s. n6 A$ f
/ w5 n/ X, e0 S# g0 ]+ G

[color=rgba(58, 58, 58, 0.87843137254902)] drbdadm create-md image

[color=rgba(58, 58, 58, 0.87843137254902)]/dev/loop3 is only 0 bytes. That's not enough.

[color=rgba(58, 58, 58, 0.87843137254902)]Command 'drbdmeta 1 v08 /dev/loop3 flex-external create-md' terminated with exit code 10

0 @, S# }4 v3 f$ D4 U

! T3 ?" \. }4 E( l5 m: Z+ @1 X
 楼主| 发表于 2023-12-22 01:13:46 | 显示全部楼层
Run cat /proc/drbd on both nodes:5 A9 y/ z8 v0 u6 }4 t

; M3 G- R: E% V1 Y0 u. Q( O' S' [2 [node1:1 k" l2 k. y- G/ ^& M

  _9 ^4 W: A8 E* h: ^- u  rversion: 8.4.9-1 (api:1/proto:86-101); R( K, ]$ b; t5 O' l* P
GIT-hash: 9976da086367a2476503ef7f6b13d4567327a280 build by akemi@Build64R7, 2016-12-04 01:08:48" p  `  ^  ?. b+ ~* V0 E2 ?
0: cs:WFConnection ro:Primary/Unknown ds:UpToDate/DUnknown C r----s% o7 b( {" _  X# U
    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:20970526 A) Y9 M  t5 s; l, j1 d- i# k
node2:
+ ]6 P, \6 ]  I# R' \" {; h1 f: Z( C" M
$ f9 B$ \4 _+ \- wversion: 8.4.9-1 (api:1/proto:86-101)
! ^9 [+ g) V# @# {! \$ Y- mGIT-hash: 9976da086367a2476503ef7f6b13d4567327a280 build by akemi@Build64R7, 2016-12-04 01:08:48
! d6 [9 G! ~- n6 t2 S 0: cs:WFConnection ro:Secondary/Unknown ds:Diskless/DUnknown C r----s
( `% m# J! z* }! M0 @    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:06 z' J/ K# B6 M6 A+ K
Primary and Secondary unknown.( B, Y2 V0 t: b  K' U. c8 K! t

+ O" o  }4 o9 c! [) A. ]Run drbdadm connect all on node1:) _: S9 \& X% l4 S7 x1 }
1 k# r; h6 H' I; `" L& L" p: H
r0: Failure: (125) Device has a net-config (use disconnect first)# m7 B% q" @9 X) ]& u! \# @, ~
Command 'drbdsetup-84 connect r0 ipv4:192.168.0.1:7789 ipv4:192.168.0.2:7789 --protocol=C' terminated with exit code 10, J7 U" M0 N3 v- ~6 k5 U
Run drbdadm -- --discard-my-data connect all on node2:
% {* n% R0 A+ p1 Z- T/ ~3 |  G  `& H/ w- N3 W/ d
r0: Failure: (102) Local address(port) already in use.. G# v; S  I8 f+ c$ o% V3 C
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: v  |, m+ I$ G8 ?5 [
What's wrong of using it?
% P: b( `0 d, ?6 t: U$ |2 S; h: G0 ^# y  q
Edit 1
; [, r! M  Q  E* y% c" TAfter 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:4 V& X: g' I1 \1 K; ~5 Z
1 P& ^# `4 [9 Y% `- ?+ K) ^
node1' q% D! a- m& _4 m& G
No valid meta data found
2 x  I6 |4 F8 i$ Y. N- ?! qCommand 'drbdmeta 0 v08 /dev/sdb internal apply-al' terminated with exit code 255
; ^' ?2 Z# C% inode26 ]- E/ ^" N2 n7 w: j& M% X
??: Failure: (162) Invalid configuration request
3 ~0 E' w2 X1 aadditional info from kernel:  \# M1 }6 p9 m
minor exists in different resource$ I2 \, N6 G3 w# [1 _7 F; v1 Z
Command 'drbdsetup-84 new-minor r0 0 0' terminated with exit code 10
6 L: ?/ K  L4 D) ^, n9 Q3 JEdit 2% D1 x, m( T3 D
At this time, ran systemctl start brdb on both nodes, all of them got pending. Wait for a long time returned no result.
4 Y- h; i& W2 H# z; U6 K! \8 S3 ]
" O2 r4 f. v2 |0 EAnd ran lsblk -a now:4 {; X# Z+ T! o5 u9 u8 k

0 G4 G% K# R, `% }( r2 \: j! XNAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT. u4 s# h8 `$ N0 ^2 n( _$ L
sda           8:0    0   10G  0 disk- x( L3 O3 ?- u& ^* o! ^- v: e
├─sda1        8:1    0    1G  0 part /boot
* b' k" [1 A$ H/ i/ m" _, W└─sda2        8:2    0    9G  0 part
" Y0 w7 n" }6 [; [' c* Z  ├─cl-root 253:0    0    8G  0 lvm  /. q6 n' ~: ?3 E, [6 f
  └─cl-swap 253:1    0    1G  0 lvm  [SWAP]4 r/ p$ p5 F% v) u) K1 p6 _
sdb           8:32   0   16G  0 disk- k- _! h8 x% Y* X2 \3 t+ \: F7 U
sr0          11:0    1 1024M  0 rom
$ `7 X+ F  i" I4 `" d  S8 Ddrbd0       147:0    0    2G  0 disk
您需要登录后才可以回帖 登录 | 开始注册

本版积分规则

关闭

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

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

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

GMT+8, 2026-4-9 00:00 , Processed in 0.068641 second(s), 22 queries .

Powered by Discuz! X3.4 Licensed

© 2012-2025 Discuz! Team.

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