fdfs安装配置

fdfs安装配置fastdfs是啥,百度一大堆,这里我记录下我自己的安装配置过程先安装依赖gitclonehttps://github.com/happyfish100/libfastcommon.gitcdlibfastcommon./make.sh./make.shinstall如果报错检查下gcc,git之类的是不是没装好fastdfs安装gitclonehttps://gith…

fastdfs是啥,百度一大堆,这里我记录下我自己的安装配置过程

先安装依赖

git clone https://github.com/happyfish100/libfastcommon.git
cd libfastcommon
./make.sh
./make.sh install

如果报错检查下gcc,git之类的是不是没装好

fastdfs安装

git clone https://github.com/happyfish100/fastdfs.git
cd fastdfs
./make.sh
./make.sh install

nginx还有fdfs-module也一块安装了吧

git clone https://github.com/happyfish100/fastdfs-nginx-module.git  #模块
wget http://nginx.org/download/nginx-1.15.10.tar.gz        # nginx
tar -zxvf nginx-*.gz        #解压
cd nginx*
./configure --prefix=/usr/local/nginx --add-module=/root/fastdfs-nginx-module/src/  #这里需要模块的绝对路径
make
make install

配置

先拷贝样例配置文件

cd /etc/fdfs/
cp tracker.conf.sample tracker.conf
cp storage.conf.sample storage.conf
cp client.conf.sample client.conf
cp /root/fastdfs-nginx-module/src/mod_fastdfs.conf /root/fastdfs/conf/http.conf /root/fastdfs/conf/mime.types /etc/fdfs/

创建路径

mkdir -p /home/aa/fastdfs/tracker
mkdir -p /home/aa/fastdfs/storage
mkdir -p /home/aa/fastdfs/client
mkdir -p /home/aa/fastdfs/nginx-fdfs

配置storage

vim storage.conf
base_path=/home/aa/fastdfs/storage   #storage存储data和log的跟路径,必须提前创建好
port=23000  #storge默认23000,同一个组的storage端口号必须一致
group_name=group1  #默认组名,根据实际情况修改, 同一组下的storage互相同步
store_path_count=1  #存储路径个数,需要和store_path个数匹配
store_path0=/home/mm/fastdfs/storage  #如果为空,则使用base_path
tracker_server=10.122.149.211:22122 #配置该storage监听的tracker的ip和port,可以连接多个tracker_server

配置client

vim client.conf
base_path=/home/mm/fastdfs/client/
tracker_server=10.122.149.211:22122 #配置该client监听的tracker的ip和port,一个集群内任何一个ip都是等效的

配置module

vim /etc/fdfs/mod_fastdfs.conf
base_path=/home/aa/fastdfs/nginx-fdfs
storage_path0=/home/aa/fastdfs/storage  #和storage路径相同
tracker_server=10.122.149.211:22122
url_have_group_name=true      #url里带不带group
fdfs_storaged /etc/fdfs/storage.conf start

nginx配置,添加

vim /usr/local/nginx/conf/nginx.conf    
server {
	listen 8080;
	server_name _;
	location ~/group[0-9]/ {
	ngx_fastdfs_module;
	}
	error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   html;
    }
}

启动测试

fdfs_tracker /etc/fdfs/tracker.conf start    #启动,stop停止
fdfs_storaged /etc/fdfs/storage.conf start
fdfs_upload_file /etc/client.conf test.txt			#返回group*则测试成功

开机启动:

chkconfig fdfs_trackerd on
chkconfig fdfs_storaged on

启动之后查看连接情况为:

无

nginx启动

/usr/local/nginx/sbin/nginx        # -s stop停止,-t测试配置文件,-s reload重新载入配置

加入开机自启

vim /usr/lib/systemd/system/nginx.service        #新建文件,并写入以下内容
[Unit]
Description=nginx - high performance web server
After=network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
PIDFile=/usr/local/nginx/logs/nginx.pid
ExecStartPre=/usr/local/nginx/sbin/nginx -t -c /usr/local/nginx/conf/nginx.conf
ExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
ExecReload=/usr/local/nginx/sbin/nginx -s reload
ExecStop=/usr/local/nginx/sbin/nginx -s stop
ExecQuit=/usr/local/nginx/sbin/nginx -s quit
PrivateTmp=true
[Install]
WantedBy=multi-user.target

重新载入systemctl

systemctl daemon-reload

然后就可以用systemctl管理nginx了

systemctl enable nginx    # 开机启动
systemctl start nginx    # 启动nginx
systemctl stop nginx    # 关闭
systemctl reload nginx    # 重载

原博客

今天的文章fdfs安装配置分享到此就结束了,感谢您的阅读。

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
如需转载请保留出处:https://bianchenghao.cn/8892.html

(0)
编程小号编程小号

相关推荐

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注