The Gluster Blog

Gluster blog stories provide high-level spotlights on our users all over the world

How to expand GlusterFS replicated clusters by one server

Gluster
2012-10-08

This has come up several times in the last week. “I have 2n servers with 2 or 4 bricks each and I want to add 1 more server. How do I ensure the new server isn’t a replica of itself?”

This isn’t a simple thing to do. When you add bricks, replicas are added with each set of bricks in the replica count. For “replica 2”, each 2 new bricks added forms a replica pair. To prevent your two new bricks on the new server from being replicas of themselves, you’ll need to move an old brick to the new server. This is done with the replace-brick command.

Replica Expansion Diagram

So first we move server1:/data/brick2 to server3:/data/brick2

volname=myvol1
from=server1:/data/brick2
to=server3:/data/brick2
gluster volume replace-brick $volname $from $to start

Monitor for completion

watch gluster volume replace-brick $volname $from $to status

Once it’s completed then commit the change

gluster volume replace-brick $volname $from $to commit

Check your data to ensure it’s all working right. If not, panic! Well, I suppose you could come join us in the IRC channel to help you figure out why, but it really should just work. First thing we’re going to tell you is to check the logs, so might as well do that too.

Ok, now that your data’s all moved, your volume is completely operational and all it’s circuits are functioning perfectly, you’re ready to add your two new bricks.

Save yourself some time and just format the brick store that’s mounted at server1:/data/brick2. You’ll have to wipe it and it’s xattrs anyway, so that’s much quicker.

gluster volume add-brick $volname server1:/data/brick2 server3:/data/brick1
gluster volume rebalance $volname start

And you’re all set.

BLOG

  • 06 Dec 2020
    Looking back at 2020 – with g...

    2020 has not been a year we would have been able to predict. With a worldwide pandemic and lives thrown out of gear, as we head into 2021, we are thankful that our community and project continued to receive new developers, users and make small gains. For that and a...

    Read more
  • 27 Apr 2020
    Update from the team

    It has been a while since we provided an update to the Gluster community. Across the world various nations, states and localities have put together sets of guidelines around shelter-in-place and quarantine. We request our community members to stay safe, to care for their loved ones, to continue to be...

    Read more
  • 03 Feb 2020
    Building a longer term focus for Gl...

    The initial rounds of conversation around the planning of content for release 8 has helped the project identify one key thing – the need to stagger out features and enhancements over multiple releases. Thus, while release 8 is unlikely to be feature heavy as previous releases, it will be the...

    Read more