GlusterFS客户端挂载

  • A+
所属分类:Linux基础 Linux技术

gluster服务端查看volume

[root@gluster01 ~]# gluster volume info 
Volume Name: k8s-logs
Type: Replicate
Volume ID: d9b1b9e2-fd15-41f2-ab7b-ab46fb989ff0
Status: Started
Snapshot Count: 0
Number of Bricks: 1 x 2 = 2
Transport-type: tcp
Bricks:
Brick1: gluster01:/data/k8s-logs
Brick2: gluster02:/data/k8s-logs
Options Reconfigured:
performance.client-io-threads: off
nfs.disable: on
transport.address-family: inet
 
Volume Name: test-log
Type: Replicate
Volume ID: d11c0c51-13bc-4d46-9cfa-57b178986740
Status: Started
Snapshot Count: 0
Number of Bricks: 1 x 2 = 2
Transport-type: tcp
Bricks:
Brick1: gluster01:/data/test-log
Brick2: gluster02:/data/test-log
Options Reconfigured:
performance.client-io-threads: off
nfs.disable: on
transport.address-family: inet

客户端挂载参数

backupvolfile-server=server-name              #在安装fuse客户端时添加了这个选择,则当第一个vofile服务器故障时,该选项执行的的服务器将用作volfile服务器来安装客户端
volfile-max-fetch-attempts=number of attempts  #指定在装入卷时尝试获取卷文件的尝试次数。
log-level=loglevel  #日志级别
log-file=logfile    #日志文件
transport=transport-type  #指定传输协议
direct-io-mode=[enable|disable]
use-readdirp=[yes|no]  #设置为ON,则强制在fuse内核模块中使用readdirp模式

安装客户端

yum -y install glusterfs-client

创建挂载目录

mkdir /elk/test1-logs 
mkdir /elk/test2-logs

挂载命令

mount.glusterfs 192.168.0.215:/k8s-logs /elk/test1-logs -o backupvolfile-server=192.168.0.216,log-level=WARNING,log-file=/var/log/gluster.log
mount.glusterfs 192.168.0.215:/test-log /elk/test2-logs -o backupvolfile-server=192.168.0.216,log-level=WARNING,log-file=/var/log/gluster.log

报错提示无法发现gluster01,绑定hosts

[2019-02-20 02:52:49.418984] E [name.c:267:af_inet_client_get_remote_sockaddr] 0-k8s-logs-client-1: DNS resolution failed on host gluster02
[2019-02-20 02:52:50.419462] E [name.c:267:af_inet_client_get_remote_sockaddr] 0-k8s-logs-client-0: DNS resolution failed on host gluster01

The message "E [MSGID: 101075] [common-utils.c:320:gf_resolve_ip6] 0-resolver: getaddrinfo failed (Name or service not known)" repeated 73 times between [2019-02-20 02:51:01.380468] and [2019-02-20 02:52:50.419460]

解析主机名

[root@ELK elk]# vim /etc/hosts
192.168.0.215 gluster01
192.168.0.216 gluster02

设置开机自启动

[root@ELK elk]# vim /etc/rc.local 
mount.glusterfs 192.168.0.215:/k8s-logs /elk/test1-logs -o backupvolfile-server=192.168.0.216,log-level=WARNING,log-file=/var/log/gluster.log
mount.glusterfs 192.168.0.215:/test-log /elk/test2-logs -o backupvolfile-server=192.168.0.216,log-level=WARNING,log-file=/var/log/gluster.log

还可以使用/etc/fstab自动挂载,这里有挂载参数,使用rc.local进行挂载

192.168.0.215:/k8s-logs /elk/test1-logs glusterfs defaults,_netdev 0 0
192.168.0.215:/test-log /elk/test2-logs glusterfs defaults,_netdev 0 0

使用mount -a检测并挂载测试

YaLei

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: