Coder Social home page Coder Social logo

gluster-server's Introduction

Gluster Server

This repository will help to create a GlusterFS server cluster using docker containers.

This example setup needs 2 servers and several dns entries. Serversnames are core-1 and core-2, with the following dns entries:

  • core-1 -> gluster.core-1.mydomain
  • core-2 -> gluster.core-2.mydomain

Use round-robin dns to core-1 and core-2 on the client.

Both servers are identical in this setup and use the same volume mounts.

Take care to use a private network since all ports are opened to the host interface. The hosts /data directory filesystem needs to be glusterfs compatible, btrfs, xfs etc.

Build

Build the docker image

docker build -t blang/gluster-server .

It's also available on dockerhub as blang/gluster-server.

Bootstrap

Servers need a setup with some manual steps.

On both servers

mkdir -p /data/glusterserver/data
mkdir -p /data/glusterserver/metadata
mkdir -p /data/glusterserver/etc
cp hosts /data/glusterserver/etc/hosts

Create self-reference in containers /etc/hosts for each file:

echo "127.0.0.1 gluster.core-%i.mydomain" >> /data/glusterserver/etc/hosts

Replace %i with current host number. Otherwise gluster will not work.

On core-2

Start gluster server non-interactive since setup is done on core-1.

docker run --privileged -v /data/glusterserver/data:/data -v /data/glusterserver/metadata:/var/lib/glusterd -v /data/glusterserver/etc/hosts:/etc/hosts -p 24007:24007 -p 24009:24009 -p 49152:49152 blang/gluster-server

On core-1

Start shell on core-1:

docker run --privileged -v /data/glusterserver/data:/data -v /data/glusterserver/metadata:/var/lib/glusterd -v /data/glusterserver/etc/hosts:/etc/hosts -p 24007:24007 -p 24009:24009 -p 49152:49152 -i -t blang/gluster-server /bin/bash

Inside the core-1 container:

# should return 127.0.0.1
ping gluster.core-1.mydomain

# core-2 should be reachable via private network
ping gluster.core-2.mydomain

# start glusterd
glusterd

# connect to core-2
gluster peer probe gluster.core-2.mydomain

# create volume 'datastore'
gluster --mode=script volume create datastore replica 2 gluster.core-1.mydomain:/data/datastore gluster.core-2.mydomain:/data/datastore

# start volume
gluster volume start datastore

# info should return replicated set with 2 bricks
gluster volume info datastore

# status should print both nodes to be online 
gluster volume status datastore

Stop both containers now, if everything was successful, your containers are ready to go.

Production

Run on each server:

docker run --privileged -v /data/glusterserver/data:/data -v /data/glusterserver/metadata:/var/lib/glusterd -v /data/glusterserver/etc/hosts:/etc/hosts -p 24007:24007 -p 24009:24009 -p 49152:49152 blang/gluster-server

Both server will connect to each other and heal automatically. If you need to interact with the gluster interface later, start one of those servers in shell mode, start glusterd and use gluster help.

gluster-server's People

Contributors

blang avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.