一、手工在Centos7 上面部署fastdfs
使用FastDfs centos7下的FastDFS5_09的安装与使用 x kevin提供教程
用FastDFS一步步搭建文件管理系统 x
Redis Install Step:
1.download install pkg
wget http://download.redis.io/releases/redis-4.0.2.tar.gz
2.unzip
tar xzf redis-4.0.2.tar.gz
3.install gcc/gcc-c++/zlib-devel/openssl-devel/psmisc
yum install gcc
yum -y install gcc-c++
yum install zlib-devel openssl-devel
4.compile redis source code and install it
make
make MALLOC=libc
make & install
5.edit redis.conf(e.g:setting password/modify default port)
vim redis.conf
6.startup service
redis-server redis.conf
7.use client tools connect to redis server
redis-cli #connection
auth password #use password authorization
8.shutdown redis service
redis-cli shutdown
=========================================================================
Firewall setting:
1.view firewall state
firewall -cmd --state
2.stop firewall service
systemctl stop firewalld
=========================================================================
FastDFS Install Step:
1.download libfastcommon & fastDFS
wget https://github.com/happyfish100/libfastcommon/archive/V1.0.36.tar.gz
wget https://github.com/happyfish100/fastdfs/archive/V5.11.tar.gz
2.unzip libfastcommon & fastDFS
tar xf V1.0.36.tar.gz
tar xf V5.11.tar.gz
3.compile && install libfastcommon
./make.sh
./make.sh install
4.compile && install FastDFS
./make.sh
./make.sh install
5.create fdfs data dir
mkdir -p /data/fdfs_tracker #create fdfs_stracker service base path
mkdir -p /data/fdfs_storage #create fdfs_storage service main dir
mkdir -p /data/fdfs_storage/base #create fdfs_storage service base path
mkdir -p /data/fdfs_storage/storage0 #create first storage node
mkdir -p /data/fdfs_storage/storage1 #create second storage node
6.copy redis config file(default path:/etc/fdfs/)
cp storage.conf.sample storage.conf
cp tracker.conf.sample tracker.conf
7.setting confs (replace path,modify port,set)
vim /etc/fdfs/tracker.conf
vim /etc/fdfs/storage.conf
8.startup or stop service
/etc/init.d/fdfs_trackerd start|stop
/etc/init.d/fdfs_storaged start|stop
9.view state
ps -ef|grep fdfs
netstat -nltp
10.test upload file
#创建client目录
mkdir -p /data/client
#配置client文件
cd /etc/fdfs
cp client.conf.sample client.conf
vi client.conf
************************************************
#存放日志目录 *
base_path=/data/client *
#跟踪服务器 *
tracker_server=192.168.1.222:22122 *
tracker_server=192.168.1.233:22122 *
************************************************
#create test file and upload it to server
echo "12345678" >> /data/1.txt
fdfs_upload_file /etc/fdfs/client.conf /data/1.txt
#view cluser running status
fdfs_monitor /etc/fdfs/client.conf
========================================================================
1.add user for nginx
useradd -s /sbin/nologin -M nginx
2.compile & install pcre
./configure --prefix=/data/pcre
make && make install
3.compile & install nginx module
./configure --prefix=/data/nginx --with-pcre=/usr/local/pcre-8.41 --user=nginx --group=nginx --with-http_ssl_module --with-http_realip_module --with-http_stub_status_module --add-module=/data/fastdfs-nginx-module-master/src
make && make install
4.setting nginx module conf
cd /data/fastdfs-nginx-module-master/src
cp mod_fastdfs.conf /etc/fdfs
cd /usr/local/fastdfs/conf
cp anti-steal.jpg http.conf mine.types /etc/fdfs/
vi /data/nginx/conf/nginx.conf
vim /etc/fdfs/mod_fastdfs.conf
5.startup nginx
/data/nginx/sbin/nginx