Utilice Docker para crear un clúster fastdfs

enlaces relacionados

Repositorio de software relacionado y Dockerfile: https://github.com/gzlj/fastdfs.git

Cree un clúster de fastdfs con rastreadores duales y almacenamiento dual


Perfil de host:
192.168.25.124-ejecutar un rastreador, un almacenamiento (también hay un servicio nginx en el contenedor)
192.168.25.125-ejecutar un rastreador, un almacenamiento (también hay un servicio nginx en el contenedor)


# 1) Ejecute el servidor de seguimiento en 192.168.25.124

docker run -d --name fdfs_tracker \

-v / inicio / fastdfs / tracker: / export / fastdfs / tracker --net = host \

-e TRACKER_BASE_PATH = / export / fastdfs / tracker \

-e TRACKER_PORT = 22123 \

gzlj2018 / fastdfs: 5.11 \

sh /usr/local/src/tracker.sh


# 2) Ejecute el servidor de almacenamiento en 192.168.25.124

docker run -d --name fdfs_storage \

-v / inicio / fastdfs / almacenamiento: / exportar / fastdfs / almacenamiento --net = host \

-e PUERTO_ALMACENAMIENTO = 23001 \

-e STORAGE_BASE_PATH = / export / fastdfs / storage \

-e STORAGE_PATH0 = / export / fastdfs / almacenamiento \

-e TRACKER_SERVER = 192.168.25.124: 22123,192.168.25.125: 22123 \

-e GROUP_COUNT = 1 \

-e PUERTO_SERVIDOR_HTTP = 8081 \

-e GROUP_NAME = group1 \

gzlj2018 / fastdfs: 5.11 \

sh /usr/local/src/storage.sh


# 3) Ejecute el servidor de seguimiento en 192.168.25.125

docker run -d --name fdfs_tracker \

-v / inicio / fastdfs / tracker: / export / fastdfs / tracker --net = host \

-e TRACKER_BASE_PATH = / export / fastdfs / tracker \

-e TRACKER_PORT = 22123 \

gzlj2018 / fastdfs: 5.11 \

sh /usr/local/src/tracker.sh


# 4) Ejecute el servidor de almacenamiento en 192.168.25.125

docker run -d --name fdfs_storage \

-v / inicio / fastdfs / almacenamiento: / exportar / fastdfs / almacenamiento --net = host \

-e PUERTO_ALMACENAMIENTO = 23001 \

-e STORAGE_BASE_PATH = / export / fastdfs / storage \

-e STORAGE_PATH0 = / export / fastdfs / almacenamiento \

-e TRACKER_SERVER = 192.168.25.124: 22123,192.168.25.125: 22123 \

-e GROUP_COUNT = 1 \

-e PUERTO_SERVIDOR_HTTP = 8081 \

-e GROUP_NAME = group1 \

gzlj2018 / fastdfs: 5.11 \

sh /usr/local/src/storage.sh


Puerto host:

192.168.25.124 puerto de host

[root @ hot fastdfs_in_docker] # ip addr show | grep 192.168.25
inet 192.168.25.124/24 brd 192.168.25.255 alcance global noprefixroute ens33
[root @ hot fastdfs_in_docker] # netstat -tlunp | grep fdfs
tcp 0 0 0.0.0.0: 22123 0.0.0.0:* ESCUCHA 33295 / fdfs_trackerd
tcp 0 0 0.0.0.0: 23001 0.0.0.0:* ESCUCHA 35292 / fdfs_storaged
[root @ hot fastdfs_in_docker] # netstat -tlunp | grep nginx
tcp 0 0 0.0.0.0: 8081 0.0.0.0:* ESCUCHA 35288 / nginx: master

192.168.25.125 puerto de host

[root @ cool logs] # ip addr show | grep 192.168.25
inet 192.168.25.125/24 brd 192.168.25.255 alcance global noprefixroute ens33
[root @ cool logs] # netstat -tlunp | grep fdfs
tcp 0 0 0.0.0.0: 22123 0.0.0.0:* LISTEN 38084 / fdfs_trackerd
tcp 0 0 0.0.0.0: 23001 0.0.0.0:* LISTEN 40428 / fdfs_storaged
[root @ cool logs] # netstat -tlunp | grep nginx
tcp 0 0 0.0.0.0: 8081 0.0.0.0:* ESCUCHA 40424 / nginx: master


Vista de registro:

Ingrese al contenedor o vea el registro en el host: se encuentra que hay dos servidores rastreadores, y el servidor rastreador líder es 192.168.25.124:22123

[root @ cool logs] # ip addr show | grep 192.168.25.125

inet 192.168.25.125/24 brd 192.168.25.255 alcance global noprefixroute ens33
[root @ cool logs] # cd / home / fastdfs / storage / logs

[root @ cool logs] # tail storaged.log

ruta de datos: / export / fastdfs / storage / data, mkdir sub dir done.

[2019-05-09 01:54:43] INFO - file: storage_param_getter.c, línea: 191, use_storage_id = 0, id_type_in_filename = ip, storage_ip_changed_auto_adjust = 1, store_path = 0, reservado_storage_space = 10.00%, use_trunk_file_space = 0 = 256, slot_max_size = 16 MB, trunk_file_size = 64 MB, trunk_create_file_advance = 0, trunk_create_file_time_base = 02:00, trunk_create_file_interval = 86400, trunk_create_file_space_threshold = 20 GB, trunk_init_init_comprobar_log

[2019-05-09 01:54:43] INFO - archivo: storage_func.c, línea: 257, tracker_client_ip: 192.168.25.125, my_server_id_str: 192.168.25.125, g_server_id_in_filename: 2098833600

[2019-05-09 01:54:43] INFO - archivo: tracker_client_thread.c, línea: 310, conectarse correctamente al servidor de seguimiento 192.168.25.125:22123, como cliente de seguimiento, mi IP es 192.168.25.125

[2019-05-09 01:54:43] INFO - archivo: tracker_client_thread.c, línea: 1947, servidor de seguimiento: # 0. 192.168.25.124:22123, my_report_status: -1

[2019-05-09 01:54:44] INFO - archivo: tracker_client_thread.c, línea: 310, conectarse correctamente al servidor de seguimiento 192.168.25.124:22123, como cliente de seguimiento, mi IP es 192.168.25.125

[2019-05-09 01:54:44] INFO - archivo: tracker_client_thread.c, línea: 1947, servidor de seguimiento: # 0. 192.168.25.124:22123, my_report_status: -1

[2019-05-09 01:54:44] INFO - archivo: tracker_client_thread.c, línea: 1263, servidor de seguimiento 192.168.25.124:22123, establecer líder de seguimiento: 192.168.25.124:22123

[2019-05-09 01:54:44] INFO - archivo: storage_sync.c, línea: 2732, conectarse correctamente al servidor de almacenamiento 192.168.25.124:23001


subir archivos

[root @ hot fastdfs_in_docker] # docker exec -it fdfs_tracker bash
[root @ hot /] # fdfs_upload_file /etc/fdfs/client.conf /etc/hosts.txt
group1 / M00 / 00/00 / wKgZfVzTl4CAWQxoAAABFo3.txt

Inserte la descripción de la imagen aquí
Inserte la descripción de la imagen aquí

Supongo que te gusta

Origin blog.csdn.net/nangonghen/article/details/90024276
Recomendado
Clasificación