以CentOS 8为例,用单个服务节点,以一键安装的方式体验下FastCFS。 此方式仅供体验使用,不适合在生产环境使用.
git clone https://gitee.com/fastdfs100/FastCFS.git
涉及到libfuse的安装更新以及在/usr/local下创建目录,请务必使用sudo或者root的方式安装。
cd FastCFS/
sudo ./helloWorld.sh
安装过程中会有进度提示信息,全自动进行,当看到以下提示时说明安装成功了。
INFO: Copy file fuse.conf to /etc/fastcfs/fcfs/
waiting services ready ...
/dev/fuse 38G 0 38G 0% /opt/fastcfs/fuse
the mounted path is: /opt/fastcfs/fuse
have a nice day!
安装成功后,通过df -h 可以看到新增一个/dev/fuse的设备,默认容量与你的磁盘容量有关,非固定值。比如我的是38G.
Filesystem Size Used Avail Use% Mounted on
devtmpfs 189M 0 189M 0% /dev
tmpfs 219M 0 219M 0% /dev/shm
tmpfs 219M 6.6M 212M 4% /run
tmpfs 219M 0 219M 0% /sys/fs/cgroup
/dev/mapper/cs-root 47G 5.9G 42G 13% /
/dev/sda1 1014M 242M 773M 24% /boot
tmpfs 44M 4.0K 44M 1% /run/user/1000
/dev/fuse 38G 0 38G 0% /opt/fastcfs/fuse
[[email protected] /opt/fastcfs/fuse]
$ pwd
/opt/fastcfs/fuse
[[email protected] /opt/fastcfs/fuse]
$ touch abc // 创建文件
[[email protected] /opt/fastcfs/fuse]
$ ll
total 0
-rw-rw-r--. 1 first first 0 May 14 17:06 abc
[[email protected] /opt/fastcfs/fuse]
$ rm abc // 删除文件
[[email protected] /opt/fastcfs/fuse]
$ mkdir -p d1/d2/d3 // 创建目录
[[email protected] /opt/fastcfs/fuse]
$ ll
total 0
drwxrwxr-x. 2 first first 0 May 14 17:06 d1
[[email protected] /opt/fastcfs/fuse]
$ touch d1/d2/d3/123 // 创建文件
[[email protected] /opt/fastcfs/fuse]
$ ll d1/d2/d3/123
-rw-rw-r--. 1 first first 0 May 14 17:06 d1/d2/d3/123
[[email protected] /opt/fastcfs/fuse]
$ rm -rf d1 // 删除目录
[[email protected] /opt/fastcfs/fuse]
$ ll
total 0
使用fashcfs.sh为管理脚本,可以停止、重启服务:
[[email protected] ~/FastCFS]
$ sudo ./fastcfs.sh stop
[sudo] password for first:
waiting for pid [2364] exit ...
pid [2364] exit.
waiting for pid [2379] exit ...
pid [2379] exit.
waiting for pid [2383] exit ...
pid [2383] exit.
waiting for pid [2400] exit ...
pid [2400] exit.
sudo yum remove FastCFS-auth-server FastCFS-fused fastDIR-server faststore-server -y
sudo yum remove fastDIR-config faststore-config FastCFS-auth-config FastCFS-fuse-config -y
sudo rm -rf /etc/fastcfs /opt/fastcfs /opt/faststore