FastDFS 설치 및 설정, nginx 설정 및 설치
5596 단어 Linux
설치 개발 환경
yum groupinstall "Development Tools" "Server platform Development"
1
libfastcommon 설치
cd /usr/local/ git clone https://github.com/happyfish100/libfastcommon.git cd libfastcommon/ ./make.sh ./make.sh install
fastdfs 설치
cd /usr/local/ git clone https://github.com/happyfish100/fastdfs.git cd fastdfs/ ./make.sh ./make.sh install
트 래커 설정
cd /etc/fdfs cp tracker.conf.sample tracker.conf vim /etc/fdfs/tracker.conf
disabled = false (기본 값 은 false 로 무효 여 부 를 표시 합 니 다) port = 22122 (기본 값 22122) base_path=/data/fdfs/tracker
client. conf 설정
cd /etc/fdfs cp client.conf.sample client.conf vim /etc/fdfs/client.conf
base_path=/data/fdfs/tracker tracker_server=192.168.219.21:22122
Tracker 디 렉 터 리 만 들 기
mkdir -pv /data/fdfs/tracker
시작 추적 기
centos 6 시작 방식
service fdfs_trackerd start
centos 7 시작 방식
/etc/init.d/fdfs_trackerd start
보기 포트
ss -lntup|grep 22122 tcp LISTEN 0 128 :22122 :* users:((“fdfs_trackerd”,3785,5))
추적 기 닫 기
/etc/init.d/fdfs_trackerd stop
메모: FastdFS 는 tracker 와 storage 서버 를 구분 하지만 설 치 된 소프트웨어 와 절 차 는 모두 같 습 니 다. 서로 다른 설정 파일 일 뿐 이 므 로 상기 설 치 는 tracker server 와 storage server 에 적 용 됩 니 다.
스토리 지 설정
cd /etc/fdfs cp storage.conf.sample storage.conf vim /etc/fdfs/storage.conf
disabled = false (기본 값 은 false 로 무효 여 부 를 표시 합 니 다) port = 23000 (기본 값 23000) group_name = group 1 \ # 그룹 이름 지정 base_path = / data / fdfs / storage \ # 데이터 저장 에 사용 store_path_count = 2 \ # 장치 수 설정 store_path 0 = / data / fdfs / storage / m 0 \ # 저장 경로 지정 0 store_path 1 = / data / fdfs / storage / m1 \ # 저장 경로 지정 1 메모: 같은 그룹의 저장 경 로 는 충돌 할 수 없습니다. 예 를 들 어 다음 노드 의 저장 경 로 는 m2, m3 입 니 다. tracker_server = 192.168.219.221: 22122 \ # tracker 지정 http.server_port = 8888 (기본 값 8888, nginx 에서 설정 한 감청 포트 의 일치)
mkdir - pv / data / fdfs / storage / {m0, m1} \ # 데이터 디 렉 터 리 만 들 기
시작 스토리 지
먼저 tracker 를 시작 하고 storage 를 시작 해 야 합 니 다.
/ / centos 6 시작 방식
service fdfs_storaged start
/ / centos 7 시작 방식
/etc/init.d/fdfs_storaged start
/ / 포트 보기
ss -lntup|grep 23000 LISTEN 0 128 :23000 :*
/ / 저장 소 닫 기
/etc/init.d/fdfs_storaged stop
파일 업로드 테스트
/usr/bin/fdfs_upload_file /etc/fdfs/client.conf /home/alex/test.png group1/M00/00/00/wKjbFVoXuUqALADZAAdIM2UokFM563.png 파일 ID 를 되 돌려 주 는 것 은 파일 이 업로드 되 었 음 을 설명 하 는 것 입 니 다.
저장 서버 (storage server) 설치 및 nginx 설정
fastdfs - nginx - module 모듈 설치
cd /root git clone https://github.com/happyfish100/fastdfs-nginx-module cp /root/fastdfs-nginx-module/src/mod_fastdfs.conf /etc/fdfs/ vim /etc/fdfs/mod_fastdfs.conf
connect_timeout=10 base_path = / tmp (기본 값 / tmp) tracker_server=192.168.219.21:22122 storage_server_port = 23000 (기본 설정 23000) url_have_group_name = true store_path_count = 2 \ # 장치 수 설정 store_path0=/data/fdfs/storage/m0 store_path0=/data/fdfs/storage/m1 group_name = group 1 (기본 설정 은 group 1)
nginx 의존 라 이브 러 리 설치
yum -y install pcre-devel zlib-devel yum -y install openssl openssl-devel
설치 nginx
cd /root
wget http://nginx.org/download/nginx-1.8.1.tar.gz
tar xf nginx-1.8.1.tar.gz
cd nginx-1.8.1
./configure --prefix=/application/nginx/ --add-module=../fastdfs-nginx-module/src/
make && make install
1
2
3
4
5
6
cp /root/fastdfs/conf/http.conf /etc/fdfs/ cp /root/fastdfs/conf/mime.types /etc/fdfs/
설정 nginx
vim /application/nginx/conf/nginx.conf
user root;
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 8888;
server_name localhost;
location ~/group[0-9]/ {
ngx_fastdfs_module;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
시작 nginx
cp /application/nginx/sbin/nginx /etc/init.d/ /etc/init.d/nginx
ss -lntup|grep 8888 tcp LISTEN 0 128 :8888 :* users:((“nginx”,7308,6),(“nginx”,7309,6))
firewalld - cmd 설정
8888 포트 열기
덧붙이다 firewall - cmd -- add - port = 8888 / tcp -- permanent (– permanent 가 영구적 으로 유효 합 니 다. 이 인자 가 없 으 면 재 부팅 후 효력 을 잃 습 니 다) 다시 불 러 오기 firewall-cmd --reload
접근 그림
글 의 출처:https://blog.csdn.net/alex_bean/article/details/78625131
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
바이너리 파일cat 또는tail, 터미널 디코딩 시 처리 방법cat으로 바이너리 파일을 보려고 할 때 코드가 엉망이 되어 식은땀이 났다. 웹에서 스크롤된 정보의 처리 방법과alias의 설정을 요약합니다. reset 명령을 사용하여 터미널을 재설정합니다.이렇게 하면 고치지 못하...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.