Linux installation Fastdfs

Source: Internet
Author: User
Tags openssl iptables

1. Download the libevent-2.0.14-stable.tar.gz package (enter your own location first)
1.1 Cd/home/guilf/downloads (This is where I put it)
1.2 wget http://cloud.github.com/downloads/libevent/libevent/libevent-2.0.14-stable.tar.gz (will download automatically)
1.3 cd/usr/local/java/fastdfs/libevent-2.0.14-stable (Create this path, unzip the package here)
1.4 TAR-ZXVF libevent-2.0.14-stable.tar.gz (unpacking package)
1.5./configure–prefix=/usr/local/java/fastdfs/libevent (Configure is to be installed prefix is to the path, followed by the path)
1.6 Make (Compile)
1.7 Make install (run installation)

2. Download the fastdfs_v5.01.tar.gz Package
2.1 Cd/home/guilf/downloads (This is where I put it)
2.2 cp Fastdfs_v5.01.tar.gz/usr/local/java/fastdfs (copy the package here)
2.3 TAR-ZXVF fastdfs_v5.01.tar.gz (Unpacking package)
2.4./make.sh (Compilation)
2.5./make.sh Install (Installation)

3 Edit the tracker.conf in the configuration file directory, set the relevant information and save
3.1 Cd/etc/fdfs (enter into Fdfs)
3.2 cp tracker.conf tracker1.conf Copy the tracker.conf next time you can use the
3.3 vim tracker.conf into the tracker.conf inside modify
The following is the modified content
generally only need to change the following several parameters:
Disabled=false # Enable configuration file
port=22122 #设置tracker的端口号
Base_path=/fdfs/tracker #设置tracker的数据文件和日志目录 (pre-created)
Http.server_port= 8080 #设置http端口号
3.4 modified to press exit (ESC) and then: Wq save
3.5 mkdir-p/home/guilf/downloads/fastdfs Create a directory after Base_path, no error
3.6/usr/local/bin/fdfs_trackerd/etc/fdfs/tracker.conf (Start tracker)
(/usr/local/bin/fdfs_trackerd this is Fdfs_ Trackerd path Location/etc/fdfs/tracker.conf This is the path location of tracker.conf)
3.7 ps-ef |grep Track (view process)
3.8 Netstat-ntpl |grep Fdfs (confirm boot)

4 Edit the storage.conf in the profile directory, set up the relevant information and save it.
4.1 Cd/etc/fdfs (enter into Fdfs)
4.2 cp storage.conf storage1.conf copy storage.conf next time you can use
4.3 vim storage.conf to enter St Orage.conf inside modify
generally only need to change the following several parameters:
Disabled=false #启用配置文件
group_name=group1# Group name, modify according to the actual situation
port=23000# Set the port number of the storage
base_path=/fdfs/storage# set the log directory of the storage (pre-created)
store_path_count=1# the number of storage paths that need to match the number of Store_path
store_path0=/fdfs/storage# Storage Path
Tracker_server=172.16.1.202:22122#tracker The IP address and port number of the server
Http.server_ port=8080 #设置http端口号
4.4 is modified then press exit (ESC) and then: Wq save
4.5 mkdir-p/home/guilf/downloads/fastdfs Create a directory after Base_path, No error
4.6/usr/local/bin/fdfs_storaged/etc/fdfs/storage.conf restart (startup tracker)
(/usr/local/bin/fdfs_ Storaged This is the fdfs_storaged path location/etc/fdfs/storage.conf This is the path location of storage.conf)
4.7 ps-ef |grep Track (view process)
4.8 NETSTAT-NTPL |grep Fdfs (confirm boot)

5 test if it's successful.
5.1 Cd/etc/fdfs (enter into Fdfs)
5.2 cp client.conf client.conf copy client.conf next time you can use
5.3 Vim client.conf into the file
# Modify the following configuration, others remain the default
Base_path=/fastdfs/tracker (the path we store)
tracker_server=192.168.0.200:22122 (IP for Linux virtual machine)
5.4/usr/local/bin/fdfs_upload_file/etc/fdfs/client.conf/usr/include/stdio.h test to see if the image name is processed
/usr/local/bin/fdfs_upload_file/etc/fdfs/client.conf/home/guilf/downloads/12.png
/usr/local/bin/fdfs_test/etc/fdfs/client.conf Upload/home/guilf/downloads/12.png

6. Install Fastdfs-nginx-module on all storage nodes
Fastdfs through the Tracker server, the file is placed in the Storage server storage, but the same group storage server needs to enter file replication, there is a synchronization delay problem. The fake tracker server uploads the file to 192.168.0.201, and the file ID is returned to the client after the upload is successful. At this point the FASTDFS storage cluster mechanism will synchronize this file to the same set of storage 192.168.0.202, if the file is not yet complete, the client if the file ID on the 192.168.4.126 to fetch files, there will be a file inaccessible error. Instead, Fastdfs-nginx-module can redirect files to the source server to fetch files, preventing the client from being unable to access the file due to replication latency errors

6.1 Cd/home/guilf/downloads (This is where I put all my bags)
6.2 cp FASTDFS-NGINX-MODULE_V1.16.TAR.GZ/USR/LOCAL/SRC (copy the package into the corresponding path)
6.3 CP NGINX-1.10.0.TAR.GZ/USR/LOCAL/SRC (Nginx package also copied into the inside)
6.4 Cd/usr/local/src (get here to unzip)
6.5 tar-zxvf fastdfs-nginx-module_v1.16.tar.gz (decompression fastdfs-nginx-module_v1.16.tar.gz)
6.6 tar-zxvf nginx-1.10.0.tar.gz (decompression nginx-1.10.0.tar.gz)
6.7 yum-y Install gcc pcre pcre-devel zlib zlib-devel OpenSSL openssl-devel (run in order to perform Ngnix dependent libraries)
6.8 CD./nginx-1.10.0 (into nginx inside, there are configure files)
6.9./configure--prefix=/usr/local/nginx--sbin-path=/usr/bin/nginx--add-module=/usr/local/src/ Fastdfs-nginx-module/src
(when executing./configure configuring Nginx parameters, you need to compile the Fastdfs-nginx-moudle source code as a module)
6.10 Make and make install (compiling and installing)
6.11 CD/USR/LOCAL/SRC/FASTDFS-NGINX-MODULE/SRC (inside the Fastdfs-nginx-module directory)
6.12 CP mod_fastdfs.conf/etc/fdfs/(copy configuration files from Fastdfs-nginx-module source to/etc/fdfs directory, and modify)
6.13 Cd/etc/fdfs (this inside to modify)
6.14 Vim mod_fastdfs.conf (modified)
CONNECT_TIMEOUT=10 # Client Access File connection timeout length (in seconds)
Base_path=/tmp # Temp directory (where we put the data)
TRACKER_SERVER=192.168.0.200:22122 # Tracker Service IP and ports (Linux ports)
STORAGE_SERVER_PORT=23000 # Storage Service Port
Group_name=group1 # Group Name
Url_have_group_name=true # Access link prefix plus group name
Store_path0=/fastdfs/storage # File Store path (where we put the data) and I put a place in the temp directory
6.15 cd/usr/local/src/fastdfs-master/conf (Come here)
6.16 CP http.conf mime.types/etc/fdfs/(copy some of the Fastdfs configuration files to the/etc/fdfs directory) do not know that there is no use, at first did not copy seems to be possible, just an error later added
6.17 ln-s/home/guilf/downloads/fastdfs/data//home/guilf/downloads/fastdfs/data/moo (in/fastdfs/ Create a soft connection in the storage File store directory and link it to the directory where the data is actually stored)
6.18 vim/usr/local/nginx/conf/nginx.conf (Configuring Nginx access storage files)
User nobody; (1) Change the nobody to root (my change can sometimes not change the 404 may be added)
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; (changed to Linux port, sometimes can not change, default local)
Location ~/group ([0-9])/m00 {(This is to be added)
#root/fdfs/storage/data; (someone here adds the path to the picture)
Ngx_fastdfs_module;
}
Error_page 502 503 504/50x.html;

Location =/50x.html {
root HTML;
}
}
}
6.19 yum-y Install iptables-services (if this is CentOS 7)
6.19 Vim/etc/sysconfig/iptables (set firewall)
-A input-m state--state new-m tcp-p TCP--dport 8888-j ACCEPT (add nginx port this)
-A input-m state--state new-m tcp-p TCP--dport 23000-j ACCEPT (This is the storage service port)
-A input-m state--state new-m tcp-p TCP--dport 22122-j ACCEPT (This is the tracker service port)
CentOS 7.0 defaults to using firewall as a firewall, and using iptables must be reset
1. Close the firewall directly
Systemctl Stop Firewalld.service #停止firewall
Systemctl Disable Firewalld.service #禁止firewall开机启动

2. Set up Iptables service
Yum-y Install Iptables-services

If you want to modify the firewall configuration, such as increasing firewall port 3306

Vim/etc/sysconfig/iptables
/etc/sysconfig/iptables status

Add rule
-A input-m state--state new-m tcp-p TCP--dport 8080-j ACCEPT

After saving exits

Systemctl Restart Iptables.service #重启防火墙使配置生效

Systemctl Enable Iptables.service #设置防火墙开机启动

Reboot the system to make the settings effective.

6.20/usr/bin/nginx/nginx (start Nginx)/usr/bin/nginx/nginx-s Reload (restart)
6.21 NETSTAT-UNLTP | grep nginx (Verify success)
6.22 Cat/usr/local/nginx/logs/error.log (see if the log is wrong)
Ps-ef | grep nginx


Set boot auto-start
1 vim/etc/rc.d/rc.local
2 Add the Run command line to the file:/usr/bin/nginx/nginx
Add Run command line to file:/usr/local/bin/fdfs_storaged/etc/fdfs/storage.conf restart
Add Run command line to file:/usr/local/bin/fdfs_trackerd/etc/fdfs/tracker.conf restart
Mkdir-p/USR/LOCAL/JAVA/JDK
TAR-ZXVF jdk-7u79-linux-x64.tar.gz
mkdir jdk_path.sh
Tomcat launcher./startup.sh./shutdown.sh
cd/usr/local/java/tomcat/apache-tomcat-7.0.81/bin/startup.sh

./configure--prefix=/usr/local/nginx--sbin-path=/usr/bin/nginx--add-module=/usr/local/src/fastdfs-nginx-module /src


/usr/local/bin/fdfs_download_file <config_file> <file_id> [Local_filename]
/usr/local/bin/fdfs_test/etc/fdfs/client.conf/home/guilf/downloads/12.png

Http://192.168.184.128/group1/M00/00/00/wKi4gFnEWvuAVk2UAAAUWjrUq2c775.png
Http://192.168.184.128:8888/group1/M00/00/00/wKi4gFnEWvuAVk2UAAAUWjrUq2c775.png
Http://192.168.184.128:8888/group1/M00/00/00/wKi4gFnEYoWADnXJAAAUWjrUq2c900_big.png
/home/guilf/downloads/fastdfs/data

ls/etc/rc.d/rc$ (RUNLEVEL|CUT-C3). D
Sh/etc/rc.d/rc.local
-sf/etc/rc.d/rc.local/etc/rc.d/rc3.d/s999rc.local
Use the Chkconfig nexus on/off to set up the Nexus service to boot or boot without booting

Linux installation Fastdfs

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.