云原生分布式存储系统FastCFS安装简明教程 admin 2023-08-29 16:57:02 篇首语:本文由小编为大家整理,主要介绍了云原生分布式存储系统FastCFS安装简明教程相关的知识,希望对你有一定的参考价值。 云原生分布式存储系统FastCFS安装简明教程 本篇文章转载于 FastCFS 作者 余庆 大佬的 FastDFS分享与交流 公众号。 我将自己部署 FastCFS集群 以及和 k8s集群 打通的全过程分享出来,希望能够帮助到尝试使用 FastCFS 的同学。 1. 快速部署 如果你只是想简单快速上手体验 FastCFS,作为学习或者本地测试环境而非生产环境,你可以选择以下两种方式部署 FastCFS: 部署本地单节点Docker部署 1.1 单机部署 单机部署 FastCFS 的 github 和 gitee 上面已经提供了比较完整的文档说明。我这里摘抄一些,并做下说明: 前提是安装的机器必须已经安装git客户端; 仅支持Centos7、Centos8两个Linux发行版本,笔者在Centos7环境亲测成功。 一键搭建(包括部署和运行)单节点(需要 root 身份执行): git clone https://gitee.com/fastdfs100/FastCFS.git; cd FastCFS/./helloWorld.sh# 注意:helloWorld.sh将更改FastCFS相关配置文件,请不要在多节点集群上执行! 上述操作完成后,执行命令验证安装状态: df -h /opt/fastcfs/fuse | grep fuse 如果可以看到 FastCFS 挂载的文件目录,说明安装成功,你可以把 /opt/fastcfs/fuse 当作本地文件系统访问该目录。 如果没有安装 git 客户端,也没有问题,只需要下载两个 sh 文件并放到同一个文件夹即可,它们是: helloWorld.shfastcfs.sh(值得注意的是 fastcfs.sh支持源码编译安装,但是个人觉得并不适合一键部署) 安装命令如下(有 git 客户端且已经按上一步安装成功的可以略过) mkdir fastcfscd fashcfswget https://toscode.gitee.com/fastdfs100/FastCFS/raw/master/helloWorld.shwget https://toscode.gitee.com/fastdfs100/FastCFS/raw/master/fastcfs.shchmod +x helloWorld.shchmod +x fastcfs.sh./helloWorld.sh 一键部署的详细说明,请参见这里一键部署详细说明 1.2 Docker部署 官方暂时没有提供 Docker 镜像,为了方便大家快速体验,笔者制作了一个单机版本的镜像,已经 push 到 Docker Hub,地址为:https://hub.docker.com/r/jerry6290/fastcfs 启动方式: docker run --name=fastCFS --privileged -d jerry6290/fastcfs:v3.1.0# v3.1.0是版本号,可以根据实际情况修改成最新版本号。 注意: 由于需要通过 fuse 把 FastCFS 作为目录挂载,所以在 docker run 时需要增加参数 –privileged,让容器真正有 root 权限。 登录到容器验证fastCFS docker exec -it fastCFS sh# 执行 df -h ,应该能看到 fastCFS的fs pool 被挂载到 /opt/fastcfs/fuse 目录df -hFilesystem Size Used Avail Use% Mounted onoverlay 500G 110G 391G 22% /tmpfs 64M 0 64M 0% /devtmpfs 12G 0 12G 0% /sys/fs/cgroupshm 64M 0 64M 0% /dev/shm/dev/mapper/centos-root 500G 110G 391G 22% /etc/hosts/dev/fuse 342G 0 342G 0% /opt/fastcfs/fuse# 写文件echo "Hello FastCFS" > /opt/fastcfs/fuse/FastCFS.txt# 查看文件内容cat /opt/fastcfs/fuse/FastCFS.txtHello FastCFS 当然,你也可以通过 -v 的方式把 /opt/fastcfs/fuse 目录挂载出来,具体做法就不赘述了。 该 Dockerfile 开源在 github,并通过 github Actions 自动打包并 push 到 docker hub,项目地址:https://github.com/jerry6290/dockerImage-fastCFS-Server 2. 集群部署 2.1 软硬件环境准备 FastCFS 作为一款开源云原生分布式存储系统,可以很好的部署和运行在 Intel 架构服务器环境和主流虚拟化环境,并支持绝大多数的主流硬件和网络, 支持主流的 Linux 操作系统环境。 2.1.1 操作系统发行版本要求 Linux 操作系统平台版本Red Hat Linux7.x及以上的版本CentOS7.x 及以上的版本Ubuntu LTS16.04 及以上的版本2.1.2 服务器建议配置 FastCFS 有三大组件:FastDIR、FastStore 和 FastAuth,支持部署和运行在 Intel x86-64 架构的 64 位通用硬件服务器平台(ARM 架构也是支持的,但需要使用源码编译)。 对于开发、测试和生产环境的服务器硬件配置有以下要求和建议: 开发及测试环境: 组件CPU内存硬盘网络实例数量FastDIR4核+8G+无特殊要求千兆网卡1(可和FastStore,FastAuth同机器)FastStore4核+8G+无特殊要求千兆网卡1(可和FastDIR,FastAuth同机器)FastAuth4核+8G+无特殊要求千兆网卡1(可和FastStore,FastDIR同机器)生产环境: 组件CPU内存硬盘网络实例数量FastDIR8核+16G+无特殊要求千兆网卡3及以上,最好是奇数(可和FastStore,FastAuth同机器)FastStore8核+16G+最好是SSD,容量大一些千兆网卡6及以上,可根据需求的容量而定(可和FastDIR,FastAuth同机器)FastAuth8核+16G+无特殊要求千兆网卡3及以上,最好是奇数(可和FastStore,FastDIR同机器) 注意: FastStore 对服务器和数据均采用分组方式,服务器分组简称 SG,组内的数据是冗余关系(服务器数即数据副本数)。一个 SG 可以容纳多个数据分组 DG,引入 DG 的主要目的是方便扩容时做数据迁移,因此最好预设得大一些,生产环境至少配置 256,开发测试环境至少配置 16 个。生产环境建议建 2个以上SG,每个 SG 有 3 台服务器,即 3个数据副本,所以存储数据的组件 FastStore 建议至少 2*3=6 台服务器,以保证数据完整性。FastAuth 是可选,如果需要通过 CSI 集成到 k8s,则需要 开启存储池 或 访问权限控制,需要部署 FastAuth 认证集群。FastDIR启用存储插件的话,最好配置 SSD。如果对性能和可靠性有更高的要求,FastDIR,FastStore,FastAuth 三大组件应尽可能分开部署。 2.2 环境及配置准备 2.2.1 SSH免密登录 找一个服务器当中控机,比如:192.168.0.201,以 root 用户登录到中控机,执行以下命令。将 192.168.0.204 替换成你的 受控机器 IP,按提示输入受控机器 root 用户密码,执行成功后即创建好 SSH 互信,其他机器同理。 ssh-keygen -t rsa# 一路回车ssh-copy-id 192.168.0.204 验证 ssh 免密是否成功,在中控机,通过 ssh 的方式登录受控机器 IP。如果不需要输入密码并登录成功,即表示 SSH 互信配置 成功,如果没有成功请检查受控机器的 sshd 配置和相关安全策略。 ssh 192.168.0.204 2.2.2 端口准备 FastDIR 默认集群端口 11011 默认服务端口 11012FastAuth 默认集群端口 31011 默认服务端口 31012FastStore 默认集群端口 21014 默认副本端口 21015 默认服务端口 21016 需要保证每台服务器上述的端口是相互能通的,如果是在 redhat7、centos7 版本及以上版本,可以通过 firewall-cmd 命令打开服务器之间端口通信。比如在网段 192.168.0.1/24,可以通过以下命令打开端口,其中 网段 和 –zone=public 需要自行根据自己的 zone 进行调整: firewall-cmd --permanent --zone=public --add-rich-rule="rule family="ipv4" source address="192.168.0.1/24" port protocol=tcp port=11011-11012 accept"firewall-cmd --permanent --zone=public --add-rich-rule="rule family="ipv4" source address="192.168.0.1/24" port protocol=tcp port=21014-21016 accept"firewall-cmd --permanent --zone=public --add-rich-rule="rule family="ipv4" source address="192.168.0.1/24" port protocol=tcp port=31011-31012 accept"firewall-cmd --reload 2.3 集群拓扑规划 FastCFS 支持大规模的集群,下面以最为典型的最小化集群拓扑:3台服务器组成的 1个SG(即 3数据副本)。更大规模的安装方式可参照此过程扩展安装,服务器的数量及配置参数按上文所述。 本次安装教程,笔者手头上的机器有限,准备了 4 台机器,已经安装好 centos7.9,对应的端口防火墙已经打开,,集群拓扑规划如下: 3 个 FastStore 节点、3 个 FastDIR 节点、3 个 FastAuth 节点,一个 fuse 客户端节点 FastStore、FastDIR、FastAuth 公用 3 个节点。 组件服务器IP个数FastDIR192.168.0.201,192.168.0.204,192.168.0.2053FastStore192.168.0.201,192.168.0.204,192.168.0.2053FastAuth192.168.0.201,192.168.0.204,192.168.0.2053Fast-fuse客户端192.168.0.20312.4 集群安装与配置 2.4.1 yum方式安装 FastOS.repo yum源 需要在每个节点安装,命令: rpm -ivh http://www.fastken.com/yumrepo/el7/x86_64/FastOSrepo-1.0.0-1.el7.centos.x86_64.rpm 安装FastDIR 分别在 192.168.0.201,204,205 安装 yum install fastDIR-server -y 安装完毕后,在 /etc/fastcfs 下可看到 FastDIR 的配置文件,在 /usr/bin/ 目录看到 fdir_* 相关的程序。 $ ll /etc/fastcfs/fdir/total 16-rw-r--r--. 1 root root 134 Jan 20 23:24 client.conf-rw-r--r--. 1 root root 291 Jan 20 23:24 cluster.conf-rw-r--r--. 1 root root 2160 Jan 20 23:24 server.conf-rw-r--r--. 1 root root 726 Jan 20 23:24 storage.confll /usr/bin/ | grep fdir_*-rwxr-xr-x. 1 root root 11336 Jan 20 20:51 fdir_cluster_stat-rwxr-xr-x. 1 root root 11472 Jan 20 20:51 fdir_getxattr-rwxr-xr-x. 1 root root 11344 Jan 20 20:51 fdir_list-rwxr-xr-x. 1 root root 7200 Jan 20 20:51 fdir_list_servers-rwxr-xr-x. 1 root root 11344 Jan 20 20:51 fdir_mkdir-rwxr-xr-x. 1 root root 11312 Jan 20 20:51 fdir_remove-rwxr-xr-x. 1 root root 11312 Jan 20 20:51 fdir_rename-rwxr-xr-x. 1 root root 234208 Jan 20 20:51 fdir_serverd-rwxr-xr-x. 1 root root 11384 Jan 20 20:51 fdir_service_stat-rwxr-xr-x. 1 root root 11328 Jan 20 20:51 fdir_setxattr-rwxr-xr-x. 1 root root 11328 Jan 20 20:51 fdir_stat 安装FastStore 分别在 192.168.0.201,204,205 安装 yum install faststore-server -y 安装完毕后,在 /etc/fastcfs 下可看到 FastStore 的配置文件,在 /usr/bin/ 目录看到 fs_* 相关的程序。 ll /etc/fastcfs/fstore/total 16-rw-r--r--. 1 root root 147 Jan 20 23:24 client.conf-rw-r--r--. 1 root root 1739 Jan 20 23:24 cluster.conf-rw-r--r--. 1 root root 1274 Jan 20 23:24 server.conf-rw-r--r--. 1 root root 673 Jan 20 23:24 storage.confll /usr/bin/ |egrep " fs_"-rwxr-xr-x. 1 root root 11488 Jan 13 10:32 fs_cluster_stat-rwxr-xr-x. 1 root root 11440 Jan 13 10:32 fs_delete-rwxr-xr-x. 1 root root 11480 Jan 13 10:32 fs_read-rwxr-xr-x. 1 root root 447336 Jan 13 10:32 fs_serverd-rwxr-xr-x. 1 root root 11424 Jan 13 10:32 fs_service_stat-rwxr-xr-x. 1 root root 11456 Jan 13 10:32 fs_write 安装FastAuth 分别在 192.168.0.201,204,205 安装 yum install FastCFS-auth-server -y 安装完毕后,在 /etc/fastcfs 下可看到 FastAuth 的配置文件 ll /etc/fastcfs/auth/total 20-rw-r--r--. 1 root root 411 Jan 21 00:47 auth.conf-rw-r--r--. 1 root root 134 Jan 21 00:47 client.conf-rw-r--r--. 1 root root 148 Jan 21 19:18 cluster.confdrwxr-xr-x. 2 root root 51 Jan 21 15:47 keys-rw-r--r--. 1 root root 1627 Jan 21 00:47 server.conf-rw-r--r--. 1 root root 145 Jan 21 00:47 session.conf 安装Fast-fused客户端 客户端只需要在 192.168.0.203 安装 yum remove fuse -yyum install FastCFS-fused -y 说明: centos 版本中的 fuse 为老版本的包(fuse2.x),需要卸载才可以成功安装 FastCFS-fused 依赖的 fuse3;第一次安装才需要卸载 fuse 包,以后就不用执行了。 安装完毕后,在 /etc/fastcfs 下可看到 fcfs 的配置文件 ll /etc/fastcfs/total 0drwxr-xr-x 3 root root 113 Feb 3 14:38 authdrwxr-xr-x 2 root root 23 Feb 3 14:38 fcfsdrwxr-xr-x 2 root root 84 Feb 3 14:38 fdirdrwxr-xr-x 2 root root 84 Feb 3 14:38 fstore 2.4.2 集群配置 FastCFS 并没有统一的配置中心,需要在各个节点上单独部署配置文件。配置文件分为三大类:集群配置文件、服务配置文件、客户端配置文件。 集群配置文件: 指的是描述 FastDIR 、 FastStore、FastAuth 的配置文件,入口文件名称为 cluster.conf . 该配置文件中设定是 集群的参数,如 服务节点的IP、服务端口号、集群同步端口号,服务节点的拓扑结构等。cluster.conf 文件全局统一,各个节点上的内容是相同的。 服务配置文件: 指的是服务本身的配置文件,入口文件名称 server.conf ,文件内容有 线程数量、链接数量、缓冲区大小、存储配置、日志配置等。服务配置文件的内容,可以全局不统一。不过从集群运维方便的角度考虑,服务器配置最好是统一的。 客户端配置文件: 指的是 fuse 或者其他客户端的配置,比如 fuse 客户端需要知道 fdir、fstore、fauth 的集群情况,所以客户端需要 fdir、fstore 和 fauth 的 server 服务集群的配置。 下面针对三大组件和客户端的配置进行详细说明: fdir 配置 用 root 登录主控机 192.168.0.201 修改 fdir 集群配置文件 修改 /etc/fastcfs/fdir/cluster.conf 文件,修改为上面提到的三个IP地址(修改成你自己对应的IP),[sever-1]为192.168.0.201,[sever-2]为192.168.0.204,[sever-3]为192.168.0.205,如果你有更多 fdir 节点,增加配置 [server-N] 即可,修改后的内容如下: # config the auth config filenameauth_config_filename = ../auth/auth.conf[group-cluster]# the default cluster portport = 11011[group-service]# the default service portport = 11012[server-1]host = 192.168.0.201 #节点1[server-2]host = 192.168.0.204 #节点2[server-3]host = 192.168.0.205 #节点3 修改 fdir 服务配置文件 修改 /etc/fastcfs/fdir/server.conf 文件,内容如下: # the base path to store log files# this path must be existbase_path = /opt/fastcfs/fdir# the path to store data files# can be an absolute path or a relative path# the relative path for sub directory under the base_path# this path will be created auto when not exist# default value is datadata_path = data# max concurrent connections this server support# you should set this parameter larger, eg. 10240# default value is 256max_connections = 10240# the data thread count# these threads deal CUD (Create, Update, Delete) operations# dispatched by the hash code of the namespace# if you have only one namespace, you should config this parameter to 1,# because it is meaningless to configure this parameter greater than 1 in this case# default value is 1data_threads = 1# the cluster id for generate inode# must be natural number such as 1, 2, 3, ...### IMPORTANT NOTE: do NOT change the cluster id after set because the 64 bits## inode includes the cluster id, and the inode disorder maybe## lead to confusioncluster_id = 1# config cluster serverscluster_config_filename = cluster.conf# session config filename for authsession_config_filename = ../auth/session.conf[storage-engine]# if enable the storage engine### false: use binlog directly### true: use storage engine for massive files# default value is false,如果设置为true,还需要配置storage.confenabled = false# the config filename for storagestorage_config_filename = storage.conf# the path to store the data files# can be an absolute path or a relative path# the relative path for sub directory under the base_path# this path will be created auto when not exist# default value is dbdata_path = db# the interval for lru elimination# <= 0 for never eliminate# unit: seconds# default value is 1eliminate_interval = 1# the memory limit ratio for dentry# the valid limit range is [1%, 99%]# default value is 80%memory_limit = 80%[cluster]# the listen portport = 11011# the network thread count# these threads deal network io# dispatched by the incoming socket fd# default value is 4work_threads = 2[service]port = 11012work_threads = 4 server.conf 基本上用默认配置即可,如果需要开启存储插件,需要把 [storage-engine] 下面的 enable=true,同时配置 storage.conf。 复制 cluster 文件到其他节点 fdir 的 cluster.conf, server.conf 配置完成后,把 cluster.conf 配置文件通过 scp 命令复制到其他节点(包括客户端节点),server.conf 不需要复制: scp /etc/fastcfs/fdir/cluster.conf 192.168.0.204:/etc/fastcfs/fdir/cluster.confscp /etc/fastcfs/fdir/cluster.conf 192.168.0.205:/etc/fastcfs/fdir/cluster.confscp /etc/fastcfs/fdir/cluster.conf 192.168.0.203:/etc/fastcfs/fdir/cluster.conf fstore 配置 用 root 登录主控机 192.168.0.201 修改fstore集群配置文件 非常重要: fstore 是存储数据的核心组件,修改 cluster 配置文件,一定要了解 fstore 存储的基本原理。了解 SG(服务器分组),DG(数据分组),DGC(数据分组数)等几个名词的相互关系。上面的拓扑规划时已经简单描述过,更详细查看作者余大的技术文章:https://my.oschina.net/u/3334339/blog/4870261 修改 /etc/fastcfs/fstore/cluster.conf 文件,让 fstore 的集群拓扑为:1个SG,SG 里面包含 3 台服务器(即副本数为3),DGC 为 128,修改后的内容如下: # the group count of the servers / instancesserver_group_count = 1 # SGC=1# all data groups must be mapped to the server group(s) without omission.# once the number of data groups is set, it can NOT be changed, otherwise# the data access will be confused!data_group_count = 128 #DGC# config the auth config filenameauth_config_filename = ../auth/auth.conf[group-cluster]# the default cluster portport = 21014[group-replica]# the default replica portport = 21015[group-service]# the default service portport = 21016[server-group-1]server_ids = [1, 3]data_group_ids = [1, 64]data_group_ids = [65, 128][server-1]host = 192.168.0.201[server-2]host = 192.168.0.204[server-3]host = 192.168.0.205 server.conf 基本上用默认配置即可,如果需要修改存储目录,需要修改 storage.conf,如果有多个数据盘可以配置多个目录,充分利用硬盘空间。 # the write thread count per store path# the default value is 1write_threads_per_path = 1# the read thread count per store path# the default value is 1,如果有多个盘可以配置多个目录,充分利用硬盘空间read_threads_per_path = 1# usually one store path for one disk# each store path is configurated in the section as: [store-path-$id],# eg. [store-path-1] for the first store path, [store-path-2] for# the second store path, and so on.store_path_count = 1# reserved space of each disk for system or other applications.# the value format is XX%# the default value is 10%reserved_space_per_disk = 10%#### store paths config #####[store-path-1]# the path to store the file,如果有多个盘可以配置多个目录,充分利用硬盘空间path = /opt/faststore/data 复制cluster文件到其他节点 fstore 的 cluster.conf, server.conf, storage.conf 配置完成后,把 cluster.conf 配置文件通过 scp 命令复制到其他节点,server.conf 不需要复制: scp /etc/fastcfs/fstore/cluster.conf 192.168.0.204:/etc/fastcfs/fstore/cluster.confscp /etc/fastcfs/fstore/cluster.conf 192.168.0.205:/etc/fastcfs/fstore/cluster.conf fauth 配置 用root登录主控机 192.168.0.201 修改fauth集群配置文件 修改 /etc/fastcfs/auth/cluster.conf 文件,修改为上面提到的三个IP地址(修改成你自己对应的IP), [sever-1]为192.168.0.201,[sever-2]为192.168.0.204,[sever-3]为192.168.0.205,如果你有更多 fauth 节点,增加配置 [server-N] 即可,修改后的内容如下: [group-cluster]# the default cluster portport = 31011[group-service]# the default service portport = 31012[server-1]host = 192.168.0.201[server-2]host = 192.168.0.204[server-3]host = 192.168.0.205 修改auth.conf开启认证 修改 /etc/fastcfs/auth/auth.conf 文件里面的 auth_enabled = true ,修改后内容: # enable / disable authentication# default value is falseauth_enabled = true# the username for login# default value is adminusername = admin# the secret key filename of the user# variable $username will be replaced with the value of username# default value is keys/$username.keysecret_key_filename = keys/$username.key# the config filename of auth clientclient_config_filename = client.conf 复制cluster文件到其他节点 fauth 的 cluster.conf, auth.conf 配置完成后,把 cluster.conf、auth.conf 配置文件通过 scp 命令复制到其他节点,server.conf 不需要复制: scp /etc/fastcfs/auth/cluster.conf 192.168.0.204:/etc/fastcfs/auth/cluster.confscp /etc/fastcfs/auth/cluster.conf 192.168.0.205:/etc/fastcfs/auth/cluster.confscp /etc/fastcfs/auth/cluster.conf 192.168.0.203:/etc/fastcfs/auth/cluster.confscp /etc/fastcfs/auth/auth.conf 192.168.0.204:/etc/fastcfs/auth/auth.confscp /etc/fastcfs/auth/auth.conf 192.168.0.205:/etc/fastcfs/auth/auth.confscp /etc/fastcfs/auth/auth.conf 192.168.0.203:/etc/fastcfs/auth/auth.conf 集群启动 集群的配置文件在各个节点已经配置和分发完毕,下面可以开始启动集群了。 启动顺序如下: fdir fauth fstore 用 root 用户分别登录到 3 个节点,执行如下命令: systemctl restart fastdirsystemctl restart fastauthsystemctl restart faststore 如果启动有问题,请检查配置文件,具体启动日志可以查看 /opt/fastcfs/ 下对应的 auth、fdir、fstore 三个目录里面的logs目录。 客户端启动 如果三个节点的所有组件启动没有错误,在客户端节点可以启动客户端程序,把 FastCFS 的默认 pool fs 挂载到相应目录。 以本次部署为例,root 用户登录到客户端节点 192.168.0.203,执行命令: systemctl restart fastcfs 查看日志文件 /opt/fastcfs/fcfs/logs/fcfs_fused.log 看下启动是否有误,如果无误可以通过 df -h 查看挂载的目录 /opt/fastcfs/fuse df -hFilesystem Size Used Avail Use% Mounted onoverlay 500G 110G 391G 22% /tmpfs 64M 0 64M 0% /devtmpfs 12G 0 12G 0% /sys/fs/cgroupshm 64M 0 64M 0% /dev/shm/dev/mapper/centos-root 500G 110G 391G 22% /etc/hosts/dev/fuse 342G 0 342G 0% /opt/fastcfs/fuse 2.4.3 部署工具fastcfs.sh安装 运维工具 fastcfs.sh 方式的安装,请参考官方文档,这里不赘述:https://github.com/happyfish100/FastCFS/blob/master/docs/fcfs-ops-tool-zh_CN.md 2.4.4 Ansible方式安装(推荐、未完成) 2.4.4 K8S Operator方式安装(未完成) 2.5 验证集群状态 2.5.1 fdir集群状态 查询fdir整个集群状态 fdir_cluster_stat# 输出如下server_id: 1, host: 192.168.0.201:11012, status: 23 (ACTIVE), is_master: 0server_id: 2, host: 192.168.0.204:11012, status: 23 (ACTIVE), is_master: 0server_id: 3, host: 192.168.0.205:11012, status: 23 (ACTIVE), is_master: 1server count: 3 查询 fdir 某个节点状态,1 表示是 server 编号,和 cluster.conf 里面的 server-N 相对应。 fdir_service_stat 1# 输出如下 server_id: 1 host: 192.168.0.201:11012 status: 23 (ACTIVE) is_master: false connection : current: 4, max: 4 binlog : current_version: 48 dentry : current_inode_sn: 5000020, ns_count: 2, dir_count: 10, file_count: 4 2.5.2 fstore集群状态 显示所有状态 fs_cluster_stat# 输出如下:data_group_id: 1 server_id: 1, host: 192.168.0.201:21016, status: 5 (ACTIVE), is_preseted: 0, is_master: 0, data_version: 0 server_id: 2, host: 192.168.0.204:21016, status: 5 (ACTIVE), is_preseted: 1, is_master: 1, data_version: 0 server_id: 3, host: 192.168.0.205:21016, status: 5 (ACTIVE), is_preseted: 0, is_master: 0, data_version: 0.... 省略N个data_group_id: 127 server_id: 1, host: 192.168.0.201:21016, status: 5 (ACTIVE), is_preseted: 0, is_master: 0, data_version: 0 server_id: 2, host: 192.168.0.204:21016, status: 5 (ACTIVE), is_preseted: 1, is_master: 1, data_version: 0 server_id: 3, host: 192.168.0.205:21016, status: 5 (ACTIVE), is_preseted: 0, is_master: 0, data_version: 0data_group_id: 128 server_id: 1, host: 192.168.0.201:21016, status: 5 (ACTIVE), is_preseted: 0, is_master: 0, data_version: 0 server_id: 2, host: 192.168.0.204:21016, status: 5 (ACTIVE), is_preseted: 0, is_master: 0, data_version: 0 server_id: 3, host: 192.168.0.205:21016, status: 5 (ACTIVE), is_preseted: 1, is_master: 1, data_version: 0data server count: 384 显示某个 sg 状态,比如 sg=1 fs_cluster_stat -g 1#输出如下:data_group_id: 1 server_id: 1, host: 192.168.0.201:21016, status: 5 (ACTIVE), is_preseted: 1, is_master: 1, data_version: 0 server_id: 2, host: 192.168.0.204:21016, status: 5 (ACTIVE), is_preseted: 0, is_master: 0, data_version: 0 server_id: 3, host: 192.168.0.205:21016, status: 5 (ACTIVE), is_preseted: 0, is_master: 0, data_version: 0data server count: 3 更多查看 fs_cluster_stat -help 2.5.3 fauth集群状态 fauth_cluster_stat#输出如下:server_id: 1, host: 192.168.0.201:31012, is_online: 1, is_master: 0server_id: 2, host: 192.168.0.204:31012, is_online: 1, is_master: 0server_id: 3, host: 192.168.0.205:31012, is_online: 1, is_master: 1server count: 3 2.6 集群管理 2.6.1 fdir相关操作 fdir 有 fdir_list、fdir_mkdir、fdir_rename、fdir_remove、fdir_getxattr、fdir_setxattr等,还有 fcfs_pool 管理、查看 pool 相关 比如查看 pool fs,可以通过 fdir_list,更多的信息查看用 -help 查看 fdir_list -n fs / 查看 pool 列表 fcfs_pool plist 2.6.2 fstore相关操作 fs_read, fs_write, fs_delete等,相关命令还不熟,研究中… 2.6.3 fauth相关操作 fcfs_user 查看,新增,删除,设置用户权限等 查看用户列表 fcfs_user list 更多操作 Usage: fcfs_user [-c config_filename=/etc/fastcfs/auth/client.conf] [-u admin_username=admin] [-k admin_secret_key_filename=/etc/fastcfs/auth/keys/$username.key] [-p priviledges=pool] <operation> [username] [user_secret_key_filename=keys/$username.key] the operations and parameters are: create <username> [user_secret_key_filename] passwd | secret-key <username> [user_secret_key_filename] [-y]: regenerate user"s secret key grant <username>, the option <-p priviledges> is required delete | remove <username> list [username] [user_secret_key_filename]: specify the filename to store the generated secret key of the user [priviledges]: the granted priviledges seperate by comma, priviledges: user: user management pool: create storage pool cluster: monitor cluster session: subscribe session for FastDIR and FastStore server side *: for all priviledges 2.7 测试集群性能 更多性能测试查看官方测试结果:https://github.com/happyfish100/FastCFS/blob/master/docs/benchmark.md 2.8 Kubernetes CSI 安装与配置 终于到了对 k8s 的支持,作为云原生分布式存储,对 k8s 的支持肯定是少不了的。 2.8.1 用户和pool准备 CSIDriver 必须要求 FastCFS 启用验证模块 auth_enabled = true,因为 k8s 的 CSI 要求支持卷、支持定义容量,不同卷是相互独立的。pool 就是为此设计的,在 CSI Driver 中一个卷就是一个 pool,而 pool 是属于用户进行管理的。 为 CSI 单独创建一个用户:k8s,当然可以用 admin 用户,但不推荐。 fcfs_user create k8screate user k8s success, secret key store to file: keys/k8s.key 新建 k8s 用户成功后会在当前目录下 keys 目录生成 k8s.key 文件,这个文件的内容后面会用到。 查看用户: fcfs_user list No. username priviledges 1. admin 以上是关于云原生分布式存储系统FastCFS安装简明教程的主要内容,如果未能解决你的问题,请参考以下文章 JS问题JQUERY问题如何让一段函数执行完毕后再执行另一段函数 如何看GPU频率 您可能还会对下面的文章感兴趣: 相关文章 浏览器打不开网址提示“ERR_CONNECTION_TIMED_OUT”错误代码的解决方法 如何安装ocx控件 VMware的虚拟机为啥ip地址老是自动变化 vbyone和EDP区别 linux/debian到底怎么重启和关机 苹果平板键盘被弄到上方去了,如何调回正常? 机器学习常用距离度量 如何查看kindle型号