|
|
楼主 |
发表于 2018-8-30 11:19:20
|
显示全部楼层
创建账户ring¶
! U5 C- Q, Q# W, z1 U u
6 n4 D9 ?4 Z1 D2 N7 F# y3 `# L帐户服务器使用帐户 ring 来维护一个容器的列表。
8 W+ v6 Y y' S* x, Z8 g2 r1 b% C$ M3 n' M0 ~& d6 }$ [
切换到 ``/etc/swift``目录。. Q& H- I" V2 Q# @! F
5 X4 m. `8 @6 `8 K: u3 z* X创建基本 account.builder 文件:
* j: X( @7 V) a5 i+ V0 J& @2 {1 Y: b C3 J
# swift-ring-builder account.builder create 10 3 1! Q8 u- s, C3 }+ q1 V! {( x
注解
$ j/ o9 |& b% e3 [/ E j4 _3 W. i, n$ c4 U" f
这个命令执行后没有输出。
8 C+ N8 _+ ?5 C
9 U; H; Z7 z+ K9 ?添加每个节点到 ring 中:$ t3 s( ~' v( C( z3 ^( p
+ D, _+ k e9 @, _7 R f# swift-ring-builder account.builder \
+ I: n1 z' w; V" v; `: l add --region 1 --zone 1 --ip STORAGE_NODE_MANAGEMENT_INTERFACE_IP_ADDRESS --port 6002 \* U* B, l4 ?1 s1 @
--device DEVICE_NAME --weight DEVICE_WEIGHT
& i- v0 ~8 ~- }9 J/ S将 STORAGE_NODE_MANAGEMENT_INTERFACE_IP_ADDRESS 替换为存储节点管理网络的IP地址。将 DEVICE_NAME``替换为同一个存储节点存储设备名称。例如,使用 :ref:`swift-storage` 中的第一个存储节点的 ``/dev/sdb 存储设备,大小为100:1 {& s- c- d1 _. U$ S" S5 J
" x% L5 O7 N2 ?( j# ~
# swift-ring-builder account.builder add \
/ j! n% Q) R2 V: {% `+ d --region 1 --zone 1 --ip 10.0.0.51 --port 6002 --device sdb --weight 100
6 d6 |3 D# M0 K在每个存储节点上面重复执行这个命令。在这个例子的架构中,使用该命令的四个变量:$ A# t8 j& [4 [$ N. V$ c
' W0 ?2 I8 m4 q" C# v3 X; O
# swift-ring-builder account.builder add \
' ]( ^6 f4 p6 I( F5 n/ @6 b. `& g --region 1 --zone 1 --ip 10.0.0.51 --port 6002 --device sdb --weight 100) j& Y. t _0 A% x k7 D( c
Device d0r1z1-10.0.0.51:6002R10.0.0.51:6002/sdb_"" with 100.0 weight got id 05 J# P4 ?: h: C7 M
# swift-ring-builder account.builder add \
! L" k, J. w4 x. o2 X9 z --region 1 --zone 1 --ip 10.0.0.51 --port 6002 --device sdc --weight 100
6 m y; R m! i) a% x7 SDevice d1r1z2-10.0.0.51:6002R10.0.0.51:6002/sdc_"" with 100.0 weight got id 1
z: U! d8 X3 T4 O& E* x# swift-ring-builder account.builder add \
6 t' N* M$ M( X$ z7 Y --region 1 --zone 2 --ip 10.0.0.52 --port 6002 --device sdb --weight 100" [2 v& A4 C f) y0 h
Device d2r1z3-10.0.0.52:6002R10.0.0.52:6002/sdb_"" with 100.0 weight got id 2
# p1 F( u. Q* A' m# swift-ring-builder account.builder add \4 C% K* P- G ]1 `( s3 _
--region 1 --zone 2 --ip 10.0.0.52 --port 6002 --device sdc --weight 100
4 W* \$ f& E& F" z) S/ r; sDevice d3r1z4-10.0.0.52:6002R10.0.0.52:6002/sdc_"" with 100.0 weight got id 3
; c( @7 e4 M; d验证 ring 的内容:
& d9 X1 ~$ T) @. e3 K6 Y, o- V2 e: Z( Z9 }! A
# swift-ring-builder account.builder
% g" w$ i! J4 B7 Q7 E* h0 p0 Jaccount.builder, build version 4
8 N5 O" `; V7 J4 `: L8 X1024 partitions, 3.000000 replicas, 1 regions, 2 zones, 4 devices, 100.00 balance, 0.00 dispersion
: j0 Z8 j( t2 |8 WThe minimum number of hours before a partition can be reassigned is 1+ X1 ^7 r y* J* K% E" d" }' F' ~7 i
The overload factor is 0.00% (0.000000)5 Q: [4 B: A- ] y# K. ~
Devices: id region zone ip address port replication ip replication port name weight partitions balance meta
) e- |& q4 R V0 W 0 1 1 10.0.0.51 6002 10.0.0.51 6002 sdb 100.00 0 -100.00
% i9 |, P4 s8 l( W' A% t 1 1 1 10.0.0.51 6002 10.0.0.51 6002 sdc 100.00 0 -100.00
6 G* e2 D: v6 x' @ 2 1 2 10.0.0.52 6002 10.0.0.52 6002 sdb 100.00 0 -100.00* b6 r0 C& k& T! E0 D2 |
3 1 2 10.0.0.52 6002 10.0.0.52 6002 sdc 100.00 0 -100.00/ C( N, p- }: ?0 q! `. u
平衡 ring:
$ [! p( k2 x( u& h- A/ g0 f9 A! E) Y! n9 v1 {' R( m
# swift-ring-builder account.builder rebalance5 R8 c5 G) M, D; e
Reassigned 1024 (100.00%) partitions. Balance is now 0.00. Dispersion is now 0.00$ z" w3 u9 ]4 t4 M
创建容器ring¶, h9 j$ K2 S8 _4 F
6 \( p7 Z5 q% N9 F) [容器服务器使用容器环来维护对象的列表。但是,它不跟踪对象的位置。) g' ?+ H$ [! x- j' @% z
* l8 L" I+ Z" i2 B0 K+ V% V切换到 ``/etc/swift``目录。
3 }' p' @( ]. `- u$ g6 m F* P' g+ X4 q6 a/ c- G9 v, @
创建基本``container.builder``文件:
. H4 b" M$ z8 `0 g H! b: h6 w
+ Y- P* P7 Q/ g. W5 O" N# swift-ring-builder container.builder create 10 3 1
$ J9 W3 X/ D' G% X8 G) | 注解$ j$ @7 v |* Q1 J2 t+ N
) n8 A: ~5 l- B# I
这个命令执行后没有输出。
0 b. x" Z8 i+ s* U `0 s& |6 |. r4 W/ W- B8 r. _, P
添加每个节点到 ring 中:1 o+ ?! b+ Y2 }! V2 b8 O( N
8 E' E6 x2 X, o& t( q* K7 ?* y
# swift-ring-builder container.builder \2 l: E% n. ^* H
add --region 1 --zone 1 --ip STORAGE_NODE_MANAGEMENT_INTERFACE_IP_ADDRESS --port 6001 \
, R3 J: b7 V7 S( X --device DEVICE_NAME --weight DEVICE_WEIGHT
( {% \. C/ u% _, [将 STORAGE_NODE_MANAGEMENT_INTERFACE_IP_ADDRESS 替换为存储节点管理网络的IP地址。将 DEVICE_NAME``替换为同一个存储节点存储设备名称。例如,使用 :ref:`swift-storage` 中的第一个存储节点的 ``/dev/sdb 存储设备,大小为100:
2 |6 L" L6 n! a7 L% ~5 q5 _$ U! {% \0 [) x2 L- H
# swift-ring-builder container.builder add \
6 o# q( ?3 I. R! D& C --region 1 --zone 1 --ip 10.0.0.51 --port 6001 --device sdb --weight 100: ~+ n1 D- A3 k& ^ o4 ]4 r4 m
在每个存储节点上面重复执行这个命令。在这个例子的架构中,使用该命令的四个变量:
: n4 t' q8 j# d- N6 J
2 e* ~6 C, Z. J: ^" m! H) x& Q# swift-ring-builder container.builder add \
; f4 ]* x- h. `( T9 j& h: P --region 1 --zone 1 --ip 10.0.0.51 --port 6001 --device sdb --weight 100
4 H: q# y, L9 {0 u' M" bDevice d0r1z1-10.0.0.51:6001R10.0.0.51:6001/sdb_"" with 100.0 weight got id 00 x3 ^; s' p9 G: l7 C. X
# swift-ring-builder container.builder add \3 m! H9 X+ [$ C' R
--region 1 --zone 1 --ip 10.0.0.51 --port 6001 --device sdc --weight 1003 S: I8 H+ }- ~" S3 Y
Device d1r1z2-10.0.0.51:6001R10.0.0.51:6001/sdc_"" with 100.0 weight got id 16 s3 D2 y+ ~8 o$ u! Y% f
# swift-ring-builder container.builder add \
/ m5 R; {; Y; V --region 1 --zone 2 --ip 10.0.0.52 --port 6001 --device sdb --weight 100
4 Y' F! o; ~4 w. W( h" Y& R% QDevice d2r1z3-10.0.0.52:6001R10.0.0.52:6001/sdb_"" with 100.0 weight got id 2& Q. w( _- G* @3 q
# swift-ring-builder container.builder add \" t5 E" Z" h1 |% {
--region 1 --zone 2 --ip 10.0.0.52 --port 6001 --device sdc --weight 100
: {4 z/ o/ m3 g- |" \, SDevice d3r1z4-10.0.0.52:6001R10.0.0.52:6001/sdc_"" with 100.0 weight got id 30 T. k4 O# @0 {7 f
验证 ring 的内容:+ \1 v0 h$ B& w- K
& B$ w& i( \; {: x1 D# swift-ring-builder container.builder
1 E6 A a7 o5 Ucontainer.builder, build version 4) y& X4 |9 h8 t9 p9 F
1024 partitions, 3.000000 replicas, 1 regions, 2 zones, 4 devices, 100.00 balance, 0.00 dispersion+ r' `: q- _$ [2 a3 N; b
The minimum number of hours before a partition can be reassigned is 1
K# u6 _. a2 F* P0 z, BThe overload factor is 0.00% (0.000000)
2 y* G* T/ L6 E9 v: ^Devices: id region zone ip address port replication ip replication port name weight partitions balance meta
) G# f# N% e5 V. s" v* I% S$ i 0 1 1 10.0.0.51 6001 10.0.0.51 6001 sdb 100.00 0 -100.00& g9 @7 i6 }8 u0 d& J1 t8 S
1 1 1 10.0.0.51 6001 10.0.0.51 6001 sdc 100.00 0 -100.00
7 U6 k. E/ L% w- P 2 1 2 10.0.0.52 6001 10.0.0.52 6001 sdb 100.00 0 -100.006 A5 T5 K) s7 w- Q6 X
3 1 2 10.0.0.52 6001 10.0.0.52 6001 sdc 100.00 0 -100.00% {9 u/ v- Z3 z, B) \6 j
平衡 ring:# Z9 k- s, |( B! A+ d
) H; j1 W$ Y6 W7 q5 c. n0 m1 s
# swift-ring-builder container.builder rebalance+ A. Y1 G2 G! _9 R# L2 R
Reassigned 1024 (100.00%) partitions. Balance is now 0.00. Dispersion is now 0.00 k- A& L" u+ ?! X2 q
创建对象ring¶
( k+ P# r: G5 @% U
: Y: o, h, l0 g+ i对象服务器使用对象环来维护对象在本地设备上的位置列表。$ m% O1 v7 A4 e8 u- U1 ~
! S" g6 {8 I) E& C6 }6 ?切换到 ``/etc/swift``目录。, n1 J' Y1 i" u6 C% R
9 Y. F* t9 d9 D1 u& ^
创建基本``object.builder``文件:) a; u& z( S8 d5 G* I2 D
6 D) H& u) ?! f- P- n% @* P# swift-ring-builder object.builder create 10 3 1+ ^% y1 W! A9 u2 N
注解
/ F; b6 V, \6 S+ Z/ n" q5 S5 Z, l. B9 u8 X! D
这个命令执行后没有输出。
1 e+ }" x5 J& S6 ^) R- N1 j8 S3 {" _( z/ I
添加每个节点到 ring 中:
# ~7 e% w, J) [( m$ c+ {5 Y5 C8 s
# swift-ring-builder object.builder \
; Q" O/ X! D4 [& ~* W( o- L. H/ X add --region 1 --zone 1 --ip STORAGE_NODE_MANAGEMENT_INTERFACE_IP_ADDRESS --port 6000 \
3 L( R8 k8 R; X* { --device DEVICE_NAME --weight DEVICE_WEIGHT
/ Y! q& }4 s/ B3 j' l2 v) N' \将 STORAGE_NODE_MANAGEMENT_INTERFACE_IP_ADDRESS 替换为存储节点管理网络的IP地址。将 DEVICE_NAME``替换为同一个存储节点存储设备名称。例如,使用 :ref:`swift-storage` 中的第一个存储节点的 ``/dev/sdb 存储设备,大小为100:
) D7 T3 {! z( Y4 Z! d+ v3 f `, D! m. r
# swift-ring-builder object.builder add \; g5 L" c1 j1 c
--region 1 --zone 1 --ip 10.0.0.51 --port 6000 --device sdb --weight 100
+ q5 l3 \; i- R D6 P在每个存储节点上面重复执行这个命令。在这个例子的架构中,使用该命令的四个变量:
# a/ K P7 }7 h2 ?" q% |! D2 c5 m% {$ ?$ |# q& I
# swift-ring-builder object.builder add \! E b/ u2 R+ ?9 z3 J" I
--region 1 --zone 1 --ip 10.0.0.51 --port 6000 --device sdb --weight 100
4 b% J# S1 J8 eDevice d0r1z1-10.0.0.51:6000R10.0.0.51:6000/sdb_"" with 100.0 weight got id 0
; i6 j" e' w! Y& u( W" ?3 c# swift-ring-builder object.builder add \6 m( `/ U- ^3 A: f- s
--region 1 --zone 1 --ip 10.0.0.51 --port 6000 --device sdc --weight 100# |% y( l4 i+ {+ C9 w
Device d1r1z2-10.0.0.51:6000R10.0.0.51:6000/sdc_"" with 100.0 weight got id 1
9 p3 T5 f% ]8 }# swift-ring-builder object.builder add \
8 X. y2 i4 T& ?$ E9 ]9 H9 k --region 1 --zone 2 --ip 10.0.0.52 --port 6000 --device sdb --weight 100. J+ x5 Y5 K2 s \/ }$ u$ e& O
Device d2r1z3-10.0.0.52:6000R10.0.0.52:6000/sdb_"" with 100.0 weight got id 2
1 v0 U* E$ M& D( {8 M" ^# swift-ring-builder object.builder add \
; W, d& n! \% W$ i) w" } --region 1 --zone 2 --ip 10.0.0.52 --port 6000 --device sdc --weight 100+ e% w; O( d3 k0 U3 E5 V# L& K; c
Device d3r1z4-10.0.0.52:6000R10.0.0.52:6000/sdc_"" with 100.0 weight got id 3
& h" _' u1 l. x% S验证 ring 的内容:
, T2 X6 }6 N' ]' ?+ [6 M4 q. M
0 q9 q, {' L& w% ?+ I# swift-ring-builder object.builder
. h: I9 b! X& B6 a9 A% Gobject.builder, build version 4
. Z" }* r. s4 }8 X) ]1024 partitions, 3.000000 replicas, 1 regions, 2 zones, 4 devices, 100.00 balance, 0.00 dispersion
. ^; F2 y; J. i9 o9 l. J( NThe minimum number of hours before a partition can be reassigned is 1
" \4 P: r" `& E3 w" D _! H& bThe overload factor is 0.00% (0.000000)! j' G+ u- X! ^4 H
Devices: id region zone ip address port replication ip replication port name weight partitions balance meta( t a* E1 |8 G) m- p& `$ D; X
0 1 1 10.0.0.51 6000 10.0.0.51 6000 sdb 100.00 0 -100.00) V% v4 g8 S/ Z
1 1 1 10.0.0.51 6000 10.0.0.51 6000 sdc 100.00 0 -100.00% a3 _6 x. M, P
2 1 2 10.0.0.52 6000 10.0.0.52 6000 sdb 100.00 0 -100.00% P/ \0 t* G' `3 P( F4 B6 L1 Y
3 1 2 10.0.0.52 6000 10.0.0.52 6000 sdc 100.00 0 -100.00' e% _" S* y: ^: D1 \# k+ E8 B
平衡 ring:
" N. L$ ?5 f* t1 K8 P
' u& R* z# o4 B( A1 w# swift-ring-builder object.builder rebalance
9 n# x% U" H/ _8 n! l3 VReassigned 1024 (100.00%) partitions. Balance is now 0.00. Dispersion is now 0.00
$ v) ?& g& I0 Q, M$ A4 `分发环配置文件¶
1 k# V* S( h+ ?8 q. X
& }* V! u( a. ~2 a1 u复制``account.ring.gz``,container.ring.gz``和``object.ring.gz 文件到每个存储节点和其他运行了代理服务的额外节点的 /etc/swift 目录。 |
|