First, upload the required documents
Connect to the server via SECURECRT, upload using the sftp feature, file upload is located in the/~ directory.
Second, install the libvent kit first
Yum-y Install Libevent
Third, install the libfastcommonV1.0.7 kit.
Switch to the ~ directory, then unzip
Tar zxf libfastcommonv1.0.7.tar.gz
Enter the libfastcommonV1.0.7 directory, install
CD libfastcommonV1.0.7
./make.sh
./make.sh Install
And then
Cp/usr/lib64/libfastcommon.so/usr/lib
Iv. Installation of tracker services
Switch working directory first, then unzip
Enter the extracted file
./make.sh (wait for the machine to complete before proceeding to the next step)
./mkae.sh Install
Configuration files are placed in the/etc/fdfs folder
CD/
CD ~
CD fastdfs/conf
Assign all files to/etc/fdfs
Configure the Tracker service. Modify the/etc/fdfs/tracker.conf file.
Path is not the case, you create a good path
Configuration complete
Start Tracker. /usr/bin/fdfs_trackerd/etc/fdfs/tracker.conf
(Restart Word use command:/usr/bin/fdfs_trackerd/etc/fdfs/tracker.conf restart)
Fifth Step: Install storage Service
If it is installed on a different server, 1~4 needs to be re-executed.
Configure the storage service. Modify the Etc/fdfs/storage.conf file
Start the service:
/usr/bin/fdfs_storaged/etc/fdfs/storage.conf
VI, build Nginx to provide HTTP services to access
Fastdfs-nginx-module_v1.16.tar.gz
1, unzip the plugin compression package tar zxf fastdfs-nginx-module_v1.16.tar.gz
2, modify the/root/fastdfs-nginx-module/src/config file, the local removed.
3. Copy the libfdfsclient.so to the/usr/lib
cp/usr/lib64/libfdfsclient.so/usr/lib/
4. Install Nginx,
Re-config to Nginx
./configure \
--prefix=/usr/local/nginx \
--pid-path=/var/run/nginx/nginx.pid \
--lock-path=/var/lock/nginx.lock \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--with-http_gzip_static_module \
--http-client-body-temp-path=/var/temp/nginx/client \
--http-proxy-temp-path=/var/temp/nginx/proxy \
--HTTP-FASTCGI-TEMP-PATH=/VAR/TEMP/NGINX/FASTCGI \
--HTTP-UWSGI-TEMP-PATH=/VAR/TEMP/NGINX/UWSGI \
--HTTP-SCGI-TEMP-PATH=/VAR/TEMP/NGINX/SCGI \
--add-module=/root/fastdfs-nginx-module/src
Make
Make install
Copy the/root/fastdfs-nginx-module/src/mod_fastdfs.conf file to the/etc/fdfs directory. Edit:
1, the configuration of Nginx
Add a server to the Nginx configuration file:
server {
Listen 80;
server_name 192.168.101.3; (IP address)
location/group1/m00/{
#root/home/fastdfs/fdfs_storage/data;
Ngx_fastdfs_module;
}
}
3. Start Nginx
The configuration is complete and the Java side uses the method provided by Fastdfs_client.jar to upload the file.
Add a resource file client.properties
Content:tracker_server=192.168.25.133:22122
Public void throws Exception { new fastdfsclient ("classpath:client.properties"); = Client.uploadfile ("d:\\documents\\pictures\\images\\200811281555127886.jpg", "jpg"); System.out.println (UploadFile); }
Path to HTTP://IP address/console output in Web pages
You can access the uploaded images.
Linux Server---Fastdfs Distributed File server configuration