天天看點

GlusterFS

glusterfs 

http://www.gluster.org/ 

$ apt-cache search glusterfs 

glusterfs-client - clustered file-system (client package) 

glusterfs-dbg - glusterfs debugging symbols 

glusterfs-examples - example files for the glusterfs server and client 

glusterfs-server - clustered file-system (server package) 

libglusterfs-dev - glusterfs development libraries and headers (development files) 

libglusterfs0 - glusterfs libraries and translator modules 

5.1. glusterfs-server 

$ sudo apt-get install glusterfs-server 

$ sudo cp /etc/glusterfs/glusterfsd.vol /etc/glusterfs/glusterfsd.vol.orig 

$ cat /etc/glusterfs/glusterfsd.vol 

### file: server-volume.vol.sample 

##################################### 

###  glusterfs server volume file  ## 

#### config file rules: 

### "#" is comment character. 

### - config file is case sensitive 

### - options within a volume block can be in any order. 

### - spaces or tabs are used as delimitter within a line. 

### - multiple values to options will be : delimitted. 

### - each option should end within a line. 

### - missing or commented fields will assume default values. 

### - blank/commented lines are allowed. 

### - sub-volumes should already be defined above before referring. 

### export volume "brick" with the contents of "/home/export" directory. 

volume brick 

  type storage/posix                   # posix fs translator 

  option directory /home/export        # export this directory 

end-volume 

### add network serving capability to above brick. 

volume server 

  type protocol/server 

  option transport-type tcp 

# option transport-type unix 

# option transport-type ib-sdp 

# option transport.socket.bind-address 192.168.1.10     # default is to listen on all interfaces 

# option transport.socket.listen-port 6996              # default is 6996 

# option transport-type ib-verbs 

# option transport.ib-verbs.bind-address 192.168.1.10     # default is to listen on all interfaces 

# option transport.ib-verbs.listen-port 6996              # default is 6996 

# option transport.ib-verbs.work-request-send-size  131072 

# option transport.ib-verbs.work-request-send-count 64 

# option transport.ib-verbs.work-request-recv-size  131072 

# option transport.ib-verbs.work-request-recv-count 64 

# option client-volume-filename /etc/glusterfs/glusterfs-client.vol 

  subvolumes brick 

# note: access to any volume through protocol/server is denied by 

# default. you need to explicitly grant access through # "auth" 

# option. 

  option auth.addr.brick.allow * # allow access to "brick" volume 

$ sudo mkdir /home/export 

$ sudo /etc/init.d/glusterfs-server start 

$ sudo /etc/init.d/glusterfs-server status 

* glusterfs server is running. 

5.2. glusterfs-client 

$ sudo apt-get install glusterfs-client 

$ sudo cp /etc/glusterfs/glusterfs.vol /etc/glusterfs/glusterfs.vol.orig 

# cat /etc/glusterfs/glusterfs.vol 

### file: client-volume.vol.sample 

###  glusterfs client volume file  ## 

### add client feature and attach to remote subvolume 

volume client 

  type protocol/client 

  option remote-host 192.168.80.1         # ip address of the remote brick 

# option transport.socket.remote-port 6996              # default server port is 6996 

# option transport.ib-verbs.remote-port 6996              # default server port is 6996 

# option transport.ib-verbs.work-request-send-size  1048576 

# option transport.ib-verbs.work-request-send-count 16 

# option transport.ib-verbs.work-request-recv-size  1048576 

# option transport.ib-verbs.work-request-recv-count 16 

# option transport-timeout 30          # seconds to wait for a reply 

                                       # from server for each request 

  option remote-subvolume brick        # name of the remote volume 

### add readahead feature 

#volume readahead 

#  type performance/read-ahead 

#  option page-size 1mb     # unit in bytes 

#  option page-count 2       # cache per file  = (page-count x page-size) 

#  subvolumes client 

#end-volume 

### add io-cache feature 

#volume iocache 

#  type performance/io-cache 

#  option page-size 256kb 

#  option page-count 2 

#  subvolumes readahead 

### add writeback feature 

#volume writeback 

#  type performance/write-behind 

#  option aggregate-size 1mb 

#  option window-size 2mb 

#  option flush-behind off 

#  subvolumes iocache   

mkdir /mnt/glusterfs 

glusterfs -f /etc/glusterfs/glusterfs.vol /mnt/glusterfs 

or 

mount -t glusterfs /etc/glusterfs/glusterfs.vol /mnt/glusterfs 

fstab 

/etc/glusterfs/glusterfs.vol  /mnt/glusterfs  glusterfs  defaults  0  0 

5.3. testing 

client 

touch /mnt/glusterfs/test1 

touch /mnt/glusterfs/test2 

server 

# ll /mnt/glusterfs 

total 0 

-rw-r--r-- 1 root root 0 jun 16 11:57 test1 

-rw-r--r-- 1 root root 0 jun 16 11:57 test2