Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Paste
P454
01-staging-ms-fe.sh
Active
Public
Actions
Authored by
thcipriani
on Mar 30 2015, 6:12 PM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Award Token
Flag For Later
Tags
None
Referenced Files
F107108: 01-staging-ms-fe.sh
Mar 30 2015, 6:12 PM
2015-03-30 18:12:07 (UTC+0)
Subscribers
None
#!/usr/bin/env bash
# Proxy
# https://wikitech.wikimedia.org/wiki/Swift/Setup_New_Swift_Cluster#build_the_rings
printf
"[
$(
tput setaf
4
)
INFO
$(
tput sgr0
)
] You should run puppet a few times first!"
printf
'\n---\n'
printf
'This runs `swift-ring-builder` in /etc/swift, OK? [y/N] '
read
ans
if
[
"
$ans
"
!
=
'y'
]
&&
[
"
$ans
"
!
=
'Y'
]
;
then
printf
"Answer '
${
ans
}
' is not Y or y, exiting...\n"
exit
fi
if
[
!
"
$(
whoami
)
"
=
'root'
]
;
then
printf
"[
$(
tput setaf
1
)
ERROR
$(
tput sgr0
)
] Try rerunning with sudo\n"
exit
1
fi
config
=
'/etc/swift'
cd
"
${
config
}
"
rm
"
${
config
}
/account.builder"
\
"
${
config
}
/account.ring.gz"
\
"
${
config
}
/container.builder"
\
"
${
config
}
/container.ring.gz"
\
"
${
config
}
/object.builder"
\
"
${
config
}
/object.ring.gz"
> /dev/null
2
>
&
1
cd
"
${
config
}
"
swift-ring-builder account.builder create
16
3
3
swift-ring-builder container.builder create
16
3
3
swift-ring-builder object.builder create
16
3
3
cd
"
${
config
}
"
for
num in
{
1
..3
}
;
do
host
=
"staging-ms-be0
${
num
}
.eqiad.wmflabs"
;
hostip
=
$(
dig +short
$host
)
;
if
[
-z
"
$hostip
"
]
;
then
printf
"[
$(
tput setaf
1
)
ERROR
$(
tput sgr0
)
] Could not find ip for %s\n"
$host
exit
1
fi
zone
=
"
${
num
}
-
${
hostip
}
"
;
weight
=
100
;
swift-ring-builder account.builder add z
${
zone
}
:6002/sdb1
$weight
;
swift-ring-builder container.builder add z
${
zone
}
:6001/sdb1
$weight
;
swift-ring-builder object.builder add z
${
zone
}
:6000/sdb1
$weight
;
done
cd
"
${
config
}
"
swift-ring-builder account.builder rebalance
swift-ring-builder container.builder rebalance
swift-ring-builder object.builder rebalance
chown -R swift:swift
"
${
config
}
"
mkdir -p /home/thcipriani/Projects/swift/staging
cp
$config
/
{
account,container,object
}
.
{
builder,ring.gz
}
/home/thcipriani/Projects/swift/staging
# ssh staging-palladium.eqiad.wmflabs -- sudo mv /home/thcipriani/Projects/swift /var/lib/puppet/volatile/
printf
"[
$(
tput setaf
5
)
RUN
$(
tput sgr0
)
] staging-palladium:\"sudo rm -rf -- /var/lib/puppet/volatile/swift\"\n"
printf
"[
$(
tput setaf
5
)
RUN
$(
tput sgr0
)
] staging-palladium:\"sudo mv /home/thcipriani/Projects/swift /var/lib/puppet/volatile/\"\n"
printf
"[
$(
tput setaf
5
)
RUN
$(
tput sgr0
)
] staging-ms-be0{1..3}:\"sudo puppet agent -t\"\n"
printf
"[
$(
tput setaf
5
)
RUN
$(
tput sgr0
)
] HERE:\"sudo swift-init all stop; sleep 1; sudo pkill swift; sleep 1; sudo swift-init all start\"\n"
Event Timeline
thcipriani
edited the content of this paste.
(Show Details)
Mar 30 2015, 6:12 PM
2015-03-30 18:12:07 (UTC+0)
thcipriani
changed the title of this paste from untitled to
01-staging-ms-fe.sh
.
thcipriani
updated the paste's language from
autodetect
to
bash
.
•
Samantha_Alipio_WMDE
mentioned this in
T252024: Some properties do not appear in search results when federated properties are enabled
.
May 6 2020, 2:55 PM
2020-05-06 14:55:17 (UTC+0)
Log In to Comment