1 Informations sur les ressources
informations sur le serveur | adresse IP |
---|---|
serveur de suivi | 192.168.51.5 |
serveur de stockage | 192.168.51.6 |
Informations sur les ressources | version | Remarques |
---|---|---|
libfastcommon | 1.0.42 | Certains packages de fonctions publiques séparés par FastDFS |
fastdfs | 6,04 | Fichier de déploiement FastDFS Linux |
Adresse du site officiel: https://github.com/happyfish100/fastdfs
Adresse de téléchargement du CSDN: collection de ressources FastDFS
Parce que le battement de cœur
storage服务
doit êtretracker服务
envoyé au démarrage , donc pendant le processus de configuration, vous devez先启动tracker服务
recommencerstorage服务
2 Téléchargement de fichiers
Adresse du document de déploiement du site Web officiel: https://github.com/happyfish100/fastdfs
Téléchargez des fichiers sur deux serveurs via FTP ou via des commandes. Mon répertoire de téléchargement est /opt/module/software/FastDFS
[root@localhost ~]# cd /opt/module/software/FastDFS
[root@localhost FastDFS]# ll
总用量 1984
-rw-r--r--. 1 root root 800157 3月 11 10:24 fastdfs-6.04.tar.gz
-rw-r--r--. 1 root root 164704 3月 11 10:24 libfastcommon-1.0.42.tar.gz
3 Configurer le service de suivi
Dans tracker服务器
le prêt à installer tracker服务
, qui est l'IP en tant 192.168.51.5
que machine virtuelle.
3.1 Installer l'environnement de base
[root@localhost FastDFS]# yum install -y gcc gcc-c++
[root@localhost FastDFS]# yum -y install libevent
3.2 Installer la bibliothèque de fonctions libfatscommon
3.2.1 Décompressez le fichier
[root@localhost FastDFS]# tar -zxvf libfastcommon-1.0.42.tar.gz
3.2.2 Compiler et installer
[root@localhost FastDFS]# cd /opt/module/software/FastDFS/libfastcommon-1.0.42
[root@localhost libfastcommon-1.0.42]# ./make.sh
[root@localhost libfastcommon-1.0.42]# ./make.sh install
3.3 Installer FastDFS
3.3.1 Décompressez le fichier
[root@localhost libfastcommon-1.0.42]# cd /opt/module/software/FastDFS/
[root@localhost FastDFS]# tar -zxvf fastdfs-6.04.tar.gz
[root@localhost FastDFS]# cd opt/module/software/FastDFS/fastdfs-6.04
[root@localhost FastDFS]# mkdir -p /usr/bin
[root@localhost FastDFS]# mkdir -p /etc/fdfs
[root@localhost fastdfs-6.04]# vi make.sh
3.3.2 Afficher le chemin d'installation
TARGET_PREFIX=$DESTDIR/usr
TARGET_CONF_PATH=$DESTDIR/etc/fdfs
TARGET_INIT_PATH=$DESTDIR/etc/init.d
3.3.3 Compiler et installer
[root@localhost fastdfs-6.04]# ./make.sh
[root@localhost fastdfs-6.04]# ./make.sh install
3.3.4 Afficher l'installation
[root@localhost fastdfs-6.04]# cd /usr/bin
[root@localhost bin]# ls fdfs_*
fdfs_appender_test fdfs_append_file fdfs_delete_file fdfs_file_info fdfs_regenerate_filename fdfs_test fdfs_trackerd fdfs_upload_file
fdfs_appender_test1 fdfs_crc32 fdfs_download_file fdfs_monitor fdfs_storaged fdfs_test1 fdfs_upload_appender
[root@localhost etc]# cd /etc/fdfs
[root@localhost fdfs]# ll
总用量 120
-rw-r--r--. 1 root root 23981 3月 11 10:35 anti-steal.jpg
-rw-r--r--. 1 root root 1834 3月 11 10:35 client.conf
-rw-r--r--. 1 root root 1834 3月 11 10:32 client.conf.sample
-rw-r--r--. 1 root root 955 3月 11 10:35 http.conf
-rw-r--r--. 1 root root 31172 3月 11 10:35 mime.types
-rw-r--r--. 1 root root 3753 3月 11 13:53 mod_fastdfs.conf
-rw-r--r--. 1 root root 10085 3月 11 10:35 storage.conf
-rw-r--r--. 1 root root 10085 3月 11 10:32 storage.conf.sample
-rw-r--r--. 1 root root 527 3月 11 10:35 storage_ids.conf
-rw-r--r--. 1 root root 527 3月 11 10:32 storage_ids.conf.sample
-rw-r--r--. 1 root root 8077 3月 11 10:48 tracker.conf
-rw-r--r--. 1 root root 8038 3月 11 10:32 tracker.conf.sample
-
/ usr / bin contient des fichiers exécutables
-
/ etc / fdfs contient des fichiers de configuration
3.4 Modifier le fichier de configuration
3.4.1 Modifier le répertoire de travail
[root@localhost conf]# cp /opt/module/software/FastDFS/fastdfs-6.04/conf/* /etc/fdfs/
[root@localhost conf]# mkdir /usr/local/fastdfs/tracker -p
[root@localhost conf]# vi /etc/fdfs/tracker.conf
# tracker工作目录,保存数据以及日志
base_path=/usr/local/fastdfs/tracker
3.4.2 Démarrer le service de suivi
[root@localhost conf]# /usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf
[root@localhost conf]# ps -ef|grep tracker
root 33667 1 0 10:49 ? 00:00:00 /usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf
3.4.3 Arrêter le service de suivi
[root@localhost conf]# /usr/bin/stop.sh /etc/fdfs/tracker.conf
4 Configurer le service de stockage
Dans storage服务器
le prêt à installer storage服务
, qui est l'IP en tant 192.168.51.6
que machine virtuelle.
4.1 Installer l'environnement de base
[root@localhost FastDFS]# yum install -y gcc gcc-c++
[root@localhost FastDFS]# yum -y install libevent
4.2 Installer la bibliothèque de fonctions libfatscommon
4.2.1 Décompressez le fichier
[root@localhost FastDFS]# tar -zxvf libfastcommon-1.0.42.tar.gz
4.2.2 Compiler et installer
[root@localhost FastDFS]# cd /opt/module/software/FastDFS/libfastcommon-1.0.42
[root@localhost libfastcommon-1.0.42]# ./make.sh
[root@localhost libfastcommon-1.0.42]# ./make.sh install
4.3 Installer FastDFS
4.3.1 Décompressez le fichier
[root@localhost libfastcommon-1.0.42]# cd /opt/module/software/FastDFS/
[root@localhost FastDFS]# tar -zxvf fastdfs-6.04.tar.gz
[root@localhost FastDFS]# cd opt/module/software/FastDFS/fastdfs-6.04
[root@localhost FastDFS]# mkdir -p /usr/bin
[root@localhost FastDFS]# mkdir -p /etc/fdfs
[root@localhost fastdfs-6.04]# vi make.sh
4.3.2 Afficher le chemin d'installation
TARGET_PREFIX=$DESTDIR/usr
TARGET_CONF_PATH=$DESTDIR/etc/fdfs
TARGET_INIT_PATH=$DESTDIR/etc/init.d
4.3.3 Compiler et installer
[root@localhost fastdfs-6.04]# ./make.sh
[root@localhost fastdfs-6.04]# ./make.sh install
4.4 Modifier le fichier de configuration
4.4.1 Configurer le stockage
[root@localhost conf]# cp /opt/module/software/FastDFS/fastdfs-6.04/conf/* /etc/fdfs/
[root@localhost conf]# mkdir /usr/local/fastdfs/storage -p
[root@localhost conf]# vi /etc/fdfs/storage.conf
修改内容
# 修改组名
group_name=auskat
# 修改storage的工作空间
base_path=/usr/local/fastdfs/storage
# 修改storage的存储空间
store_path0=/usr/local/fastdfs/storage
# 修改tracker的地址和端口号,用于心跳
tracker_server=192.168.51.5:22122
# 后续结合nginx的一个对外服务端口号
http.server_port=8888
4.4.2 Démarrer le service de stockage
[root@localhost conf]# /usr/bin/fdfs_storaged /etc/fdfs/storage.conf
[root@localhost ~]# ps -ef|grep storage
root 20276 1 0 07:09 ? 00:00:15 /usr/bin/fdfs_storaged /etc/fdfs/storage.conf
4.4.3 Arrêter le service de stockage
[root@localhost conf]# /usr/bin/stop.sh etc/fdfs/storage.conf
5 Test de fonctionnement
5.1 Modifier la configuration du client
[root@localhost conf]# mkdir /usr/local/fastdfs/client -p
[root@localhost conf]# vi /etc/fdfs/client.conf
修改内容
# 配置路径
base_path=/usr/local/fastdfs/client
# 配置tracker地址
tracker_server=192.168.51.5:22122
5.2 Test de téléchargement
Les images de test pré-préparées test.jpg
téléchargées dans le /opt/module/
répertoire
[root@localhost conf]# /usr/bin/fdfs_test /etc/fdfs/client.conf upload /opt/module/test.jpg
This is FastDFS client test program v6.04
Copyright (C) 2008, Happy Fish / YuQing
FastDFS may be copied only under the terms of the GNU General
Public License V3, which may be found in the FastDFS source kit.
Please visit the FastDFS Home Page http://www.fastken.com/
for more detail.
[2021-03-11 11:06:47] DEBUG - base_path=/usr/local/fastdfs/client, connect_timeout=10, network_timeout=60, tracker_server_count=1, anti_steal_token=0, anti_steal_secret_key length=0, use_connection_pool=0, g_connection_pool_max_idle_time=3600s, use_storage_id=0, storage server id count: 0
tracker_query_storage_store_list_without_group:
server 1. group_name=, ip_addr=192.168.51.6, port=23000
group_name=auskat, ip_addr=192.168.51.6, port=23000
storage_upload_by_filename
group_name=auskat, remote_filename=M00/00/00/wKgzBmBJiUeAI4QjAAUXmkbISCM506.jpg
source ip address: 192.168.51.6
file timestamp=2021-03-11 11:06:47
file size=333722
file crc32=1187530787
example file url: http://192.168.51.6/auskat/M00/00/00/wKgzBmBJiUeAI4QjAAUXmkbISCM506.jpg
storage_upload_slave_by_filename
group_name=auskat, remote_filename=M00/00/00/wKgzBmBJiUeAI4QjAAUXmkbISCM506_big.jpg
source ip address: 192.168.51.6
file timestamp=2021-03-11 11:06:47
file size=333722
file crc32=1187530787
example file url: http://192.168.51.6/auskat/M00/00/00/wKgzBmBJiUeAI4QjAAUXmkbISCM506_big.jpg
5.3 Afficher les informations
[root@localhost conf]# cd /usr/local/fastdfs/storage/data/00/00
root@localhost 00]# ll
总用量 872
-rw-r--r--. 1 root root 333722 3月 11 11:06 wKgzBmBJiUeAI4QjAAUXmkbISCM506_big.jpg
-rw-r--r--. 1 root root 49 3月 11 11:06 wKgzBmBJiUeAI4QjAAUXmkbISCM506_big.jpg-m
-rw-r--r--. 1 root root 333722 3月 11 11:06 wKgzBmBJiUeAI4QjAAUXmkbISCM506.jpg
-rw-r--r--. 1 root root 49 3月 11 11:06 wKgzBmBJiUeAI4QjAAUXmkbISCM506.jpg-m
-rw-r--r--. 1 root root 102921 3月 11 15:29 wKgzBmBJxtOAE2YdAAGSCZ4xzd8808.png
-rw-r--r--. 1 root root 102921 3月 11 15:39 wKgzBmBJyTmADux5AAGSCZ4xzd8581.png
6 Informations connexes
- Le billet de blog n'est pas facile, tous ceux qui ont travaillé si dur pour prêter attention et féliciter, merci