FastDFS 메모리 서버 배치

4138 단어 nginxfastdfs
패 키 지 를 준비 하 다
/opt/libevent-2.0.22-stable.tar.gz
/opt/FastDFS_v4.06.tar.gz

libevent 설치
cd /opt
tar zxvf libevent-2.0.22-stable.tar.gz
cd libevent-2.0.22-stable
./configure --prefix=/opt/yliyun/libevent/
make && make install

lib 추가:
vim /etc/ld.so.conf

다음 내용 추가:
/opt/yliyun/libevent/lib

실행:
ldconfig

FastDFS 설치
압축 풀기:
cd /opt
tar zxvf FastDFS_v4.06.tar.gz
cd FastDFS

컴 파일 설정 수정:
vim make.sh

다음 내용 을 수정 합 니 다.
TARGET_PREFIX=/opt/yliyun/fdfs
TARGET_CONF_PATH=/opt/yliyun/fdfs/etc

다음 명령 을 실행 하여 설치:
./make.sh  C_INCLUDE_PATH=/opt/yliyun/libevent/include  LIBRARY_PATH=/opt/yliyun/libevent/lib
./make.sh install

FastDFS 가 / opt / yliyun / fdfs 에 성공 적 으로 설치 되 었 습 니 다.
lib 추가:
vim /etc/ld.so.conf

다음 내용 추가:
/opt/yliyun/fdfs/lib

실행:
ldconfig

스 크 립 트 시작, 테스트 서버 에서 복사:
/opt/yliyun/bin/fdfs_trackerd
/opt/yliyun/bin/fdfs_storaged

Nginx 설치
패키지 설치 원본 패키지 준비:
/opt/ngx_openresty-1.9.3.2.tar.gz
/opt/fastdfs-nginx-module_v1.15.tar.gz

압축 해제 다음 명령 실행 압축 해제 설치 패키지:
cd /opt
tar zxvf fastdfs-nginx-module_v1.15.tar.gz
tar zxvf ngx_openresty-1.9.3.2.tar.gz

컴 파일 설정 수정:
vim fastdfs-nginx-module/src/config

수정 내용 은 다음 과 같 습 니 다.
ngx_addon_name=ngx_http_fastdfs_module
HTTP_MODULES="$HTTP_MODULES ngx_http_fastdfs_module"
NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_addon_dir/ngx_http_fastdfs_module.c"
CORE_INCS="$CORE_INCS /opt/yliyun/fdfs/include/fastdfs /opt/yliyun/fdfs/include/fastcommon/"
CORE_LIBS="$CORE_LIBS -L/opt/yliyun/fdfs/lib -lfastcommon -lfdfsclient"
CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64 -DFDFS_OUTPUT_CHUNK_SIZE='256*1024' -DFDFS_MOD_CONF_FILENAME='\"/opt/yliyun/fdfs/etc/mod_fastdfs.conf\"'"

컴 파일 설치 다음 명령 실행 컴 파일 설치 에 필요 한 의존:
yum install -y pcre-devel openssl-devel

다음 명령 을 실행 하여 openresty 를 컴 파일 설치 합 니 다.
mkdir yliyun
cd ngx_openresty-1.9.3.2
./configure --prefix=/opt/yliyun/openresty --add-module=/opt/fastdfs-nginx-module/src/ 
make
make install

openresty 는 / opt / yliyun / openresty 에 성공 적 으로 설치 되 었 습 니 다.
데이터 디 렉 터 리:
mkdir -pv /data/yliyun/data/g1_data0

로그 디 렉 터 리:
mkdir -pv /data/yliyun/logs/nginx
mkdir -pv /opt/yliyun/data/tracker
mkdir -pv /opt/yliyun/data/storage

설정 수정
FastDFS 설정 수정
Tracker 설정 수정 설정: vim / opt / yliyun / fdfs / etc / tracker. conf
다음 내용 을 수정 합 니 다.
base_path=/opt/yliyun/data/tracker

store_group=group1

Storage 설정 변경 설정:
vim /opt/yliyun/fdfs/etc/storage.conf

다음 내용 을 수정 합 니 다.
group_name=group1

base_path=/data/yliyun/logs/fdfs/storage

store_path0=/data/yliyun/data/g1_data0

tracker_server=192.168.1.2:22122

Nginx 플러그 인 설정
설정 수정:
vim /opt/yliyun/fdfs/etc/mod_fastdfs.conf

다음 내용 을 수정 합 니 다.
base_path=/data/yliyun/logs/nginx

tracker_server=192.168.1.2:22122

group_name=group1

store_path0=/data/yliyun/data/g1_data0

log_filename=/data/yliyun/logs/nginx /mod_fdfs.log

Nginx 설정 수정
nginx 설정 수정:
vim /opt/yliyun/openrestry/nginx/conf/nginx.conf

다음 설정 추가:
location ~ /group1/M0[0-9] {
ngx_fastdfs_module;
}

방화벽 배치
프로필 편집:
vim /etc/sysconfig/iptables

다음 설정 추가:
-A INPUT -s 10.137.147.0/24 -p tcp --dport 80 -j ACCEPT
-A INPUT -s 10.137.147.0/24 -p tcp --dport 22122 -j ACCEPT
-A INPUT -s 10.137.147.0/24 -p tcp --dport 23000 -j ACCEPT

방화벽 다시 시작:
service iptables restart

좋은 웹페이지 즐겨찾기