Merge "Add variable SWIFT_STORAGE_IPS"
This commit is contained in:
commit
19c7842e4f
@ -513,6 +513,18 @@ If you only want to do some testing of a real normal swift cluster
|
||||
with multiple replicas you can do so by customizing the variable
|
||||
``SWIFT_REPLICAS`` in your ``localrc`` section (usually to 3).
|
||||
|
||||
You can manually override the ring building to use specific storage
|
||||
nodes, for example when you want to test a multinode environment. In
|
||||
this case you have to set a space-separated list of IPs in
|
||||
``SWIFT_STORAGE_IPS`` in your ``localrc`` section that should be used
|
||||
as Swift storage nodes.
|
||||
Please note that this does not create a multinode setup, it is only
|
||||
used when adding nodes to the Swift rings.
|
||||
|
||||
::
|
||||
|
||||
SWIFT_STORAGE_IPS="192.168.1.10 192.168.1.11 192.168.1.12"
|
||||
|
||||
Swift S3
|
||||
++++++++
|
||||
|
||||
|
42
lib/swift
42
lib/swift
@ -149,6 +149,11 @@ SWIFT_TEMPURL_KEY=${SWIFT_TEMPURL_KEY:-}
|
||||
# Toggle for deploying Swift under HTTPD + mod_wsgi
|
||||
SWIFT_USE_MOD_WSGI=${SWIFT_USE_MOD_WSGI:-False}
|
||||
|
||||
# A space-separated list of storage node IPs that
|
||||
# should be used to create the Swift rings
|
||||
SWIFT_STORAGE_IPS=${SWIFT_STORAGE_IPS:-}
|
||||
|
||||
|
||||
# Functions
|
||||
# ---------
|
||||
|
||||
@ -693,14 +698,35 @@ function init_swift {
|
||||
swift-ring-builder container.builder create ${SWIFT_PARTITION_POWER_SIZE} ${SWIFT_REPLICAS} 1
|
||||
swift-ring-builder account.builder create ${SWIFT_PARTITION_POWER_SIZE} ${SWIFT_REPLICAS} 1
|
||||
|
||||
for node_number in ${SWIFT_REPLICAS_SEQ}; do
|
||||
swift-ring-builder object.builder add z${node_number}-${SWIFT_SERVICE_LOCAL_HOST}:$(( OBJECT_PORT_BASE + 10 * (node_number - 1) ))/sdb1 1
|
||||
swift-ring-builder container.builder add z${node_number}-${SWIFT_SERVICE_LOCAL_HOST}:$(( CONTAINER_PORT_BASE + 10 * (node_number - 1) ))/sdb1 1
|
||||
swift-ring-builder account.builder add z${node_number}-${SWIFT_SERVICE_LOCAL_HOST}:$(( ACCOUNT_PORT_BASE + 10 * (node_number - 1) ))/sdb1 1
|
||||
done
|
||||
swift-ring-builder object.builder rebalance
|
||||
swift-ring-builder container.builder rebalance
|
||||
swift-ring-builder account.builder rebalance
|
||||
# The ring will be created on each node, and because the order of
|
||||
# nodes is identical we can use a seed for rebalancing, making it
|
||||
# possible to get a ring on each node that uses the same partition
|
||||
# assignment.
|
||||
if [[ -n $SWIFT_STORAGE_IPS ]]; then
|
||||
local node_number
|
||||
node_number=1
|
||||
|
||||
for node in ${SWIFT_STORAGE_IPS}; do
|
||||
swift-ring-builder object.builder add z${node_number}-${node}:${OBJECT_PORT_BASE}/sdb1 1
|
||||
swift-ring-builder container.builder add z${node_number}-${node}:${CONTAINER_PORT_BASE}/sdb1 1
|
||||
swift-ring-builder account.builder add z${node_number}-${node}:${ACCOUNT_PORT_BASE}/sdb1 1
|
||||
let "node_number=node_number+1"
|
||||
done
|
||||
|
||||
else
|
||||
|
||||
for node_number in ${SWIFT_REPLICAS_SEQ}; do
|
||||
swift-ring-builder object.builder add z${node_number}-${SWIFT_SERVICE_LOCAL_HOST}:$(( OBJECT_PORT_BASE + 10 * (node_number - 1) ))/sdb1 1
|
||||
swift-ring-builder container.builder add z${node_number}-${SWIFT_SERVICE_LOCAL_HOST}:$(( CONTAINER_PORT_BASE + 10 * (node_number - 1) ))/sdb1 1
|
||||
swift-ring-builder account.builder add z${node_number}-${SWIFT_SERVICE_LOCAL_HOST}:$(( ACCOUNT_PORT_BASE + 10 * (node_number - 1) ))/sdb1 1
|
||||
done
|
||||
fi
|
||||
|
||||
# We use a seed for rebalancing. Doing this allows us to create
|
||||
# identical rings on multiple nodes if SWIFT_STORAGE_IPS is the same
|
||||
swift-ring-builder object.builder rebalance 42
|
||||
swift-ring-builder container.builder rebalance 42
|
||||
swift-ring-builder account.builder rebalance 42
|
||||
} && popd >/dev/null
|
||||
|
||||
# Create cache dir
|
||||
|
Loading…
Reference in New Issue
Block a user