当前位置:网站首页>Fastdfs supports dual IP and IPv6
Fastdfs supports dual IP and IPv6
2022-07-26 06:43:00 【Xijing swordsman】
List of articles
FastDFS- Support double IP Feature introduction
FastDFS V6.0 Support double IP Feature introduction
Reference resources URL: https://www.nuomiphp.com/Article/detail/id/87.html
FastDFS6.0.6 Set up the cluster
Reference resources URL: http://www.luyixian.cn/news_show_381479.aspx
v6.0 Support double IP,tracker server and storage server Both support dual IP.
v6.0 The new features are described below :
Support double IP, An intranet IP, An extranet IP, Support NAT Both internal and external networks IP, Solve the problem of cross machine room or hybrid cloud deployment . double ip This feature can solve the problem of Extranet and cross cloud .
tracker server and storage server Both can support double IP, An intranet IP, An extranet IP.
FastDFS Support double IP After characteristic , Will be fully compatible with previous orders IP Design and logic of . about storage server To use double IP characteristic , You have to use FastDFS V4.0 Introduced storage server id characteristic , That is to say, double IP Configuration to storage_ids.conf in .
double ip Connection rules
storage Connect storage server, Try to connect to the intranet first IP, If it fails, try connecting to the Internet again IP.
client towards tracker server obtain storage server IP,tracker server The rules are as follows :
Requests from the Internet , Return to the Internet IP;
Request from intranet , Return to Intranet IP.
Intranet IP The address segment is :10. Lead ,192.168. Lead and 172.[16-32). The first IP Address . notes :[10-32) Is the range representation , Is greater than or equal to 10 And less than 32 The integer of .
double ip To configure
To configure tracker
vim /etc/fdfs/tracker.conf# What needs to be revised is as follows # Note that the server is NAT Therefore, the intranet is bound here IP You can see it in the background of Alibaba cloud # You can use the command to see ifconfig -a There is no public network IP bind_addr = 172.xxx.xxx.xxx # tracker Server port ( Default 22122, Generally, it is not modified ) port=22122 # The root directory where logs and data are stored base_path=/home/dfs # use_storage_id Set to true After that, you need to storage_ids.conf Set up double IP # The original notes are as follows : # if use storage server ID instead of IP address # if you want to use dual IPs for storage server, you MUST set # this parameter to true, and configure the dual IPs in the file # configured by following item "storage_ids_filename", such as storage_ids.conf # default value is false # since V4.00 use_storage_id = trueuse_storage_id Set to true After that, you need to storage_ids.conf Set up double IP
To configure storage_ids.conf
# <id> <group_name> <ip_or_hostname[:port]> # # id is a natural number (1, 2, 3 etc.), # 6 bits of the id length is enough, such as 100001 # # storage ip or hostname can be dual IPs seperated by comma, # one is an inner (intranet) IP and another is an outer (extranet) IP, # or two different types of inner (intranet) IPs # for example: 192.168.2.100,122.244.141.46 # another eg.: 192.168.1.10,172.17.4.21 # # the port is optional. if you run more than one storaged instances # in a server, you must specified the port to distinguish different instances. # An intranet IP A public network IP 100001 group1 172.XXX.XXX.XXX,123.XXX.XXX.XXX 100002 group1 172.XXX.XXX.XXX,123.XXX.XXX.XXXTo configure storage
vim /etc/fdfs/storage.conf# What needs to be revised is as follows # storage Service port ( Default 23000, Generally, it is not modified ) port=23000 # Data and log file storage root base_path=/home/dfs # The first storage directory store_path0=/home/dfs # The point is this , Be sure to pay attention to the format Intranet , Extranet : Port number # The point is this , Be sure to pay attention to the format Intranet , Extranet : Port number # The point is this , Be sure to pay attention to the format Intranet , Extranet : Port number # tracker_server can ocur more than once for multi tracker servers. # the value format of tracker_server is "HOST:PORT", # the HOST can be hostname or ip address, # and the HOST can be dual IPs or hostnames seperated by comma, # the dual IPS must be an inner (intranet) IP and an outer (extranet) IP, # or two different types of inner (intranet) IPs. # for example: 192.168.2.100,122.244.141.46:22122 # another eg.: 192.168.1.10,172.17.4.21:22122 tracker_server = 192.168.2.100,122.244.111.111:22122 tracker_server = 192.158.2.100,123.244.222.222:22122 # http Port to access files ( Default 8888, Modify according to the situation , and nginx Consistent in ) http.server_port=8888
storage server To use double IP Words , Need to start the storage server id characteristic , stay tracker.conf Lieutenant general use_storage_id Set to true, Need to put storage server double IP Configuration to storage_ids.conf in .
FastDFS- Support IPV6
official HISTORY keyword IPv6
Version 1.41 2019-09-30
- change CIDR network_bits range from [16, 32) to [10, 32)
- ini_file_reader.c: fix empty string compare
- multi_socket_client.c: code refine
- sockopt.[hc] support IPv6
View source code sockopt.c, You can see Join in ipv6 The judgment of the , The functions used support ipv6 Function of , Such as :
inet_pton Function is random IPv6 Functions that appear , about IPv4 Address and IPv6 All addresses apply , Function p and n Each represents the expression (presentation) And numbers (numeric).
typedef struct sockaddr_convert_s {
socklen_t len;
union {
struct sockaddr addr;
struct sockaddr_in addr4;
struct sockaddr_in6 addr6;
} sa;
} sockaddr_convert_t;
...
int setsockaddrbyip(const char *ip, const short port, sockaddr_convert_t *convert)
{
int af;
void *dest;
if (is_ipv6_addr(ip))
{
convert->len = sizeof(convert->sa.addr6);
dest = &convert->sa.addr6.sin6_addr;
af = AF_INET6;
convert->sa.addr6.sin6_family = PF_INET6;
convert->sa.addr6.sin6_port = htons(port);
}
else //ipv4
{
convert->len = sizeof(convert->sa.addr4);
dest = &convert->sa.addr4.sin_addr;
af = AF_INET;
convert->sa.addr4.sin_family = PF_INET;
convert->sa.addr4.sin_port = htons(port);
}
if (inet_pton(af, ip, dest) == 0)
{
logError("file: "__FILE__", line: %d, "
"invalid %s ip address: %s", __LINE__,
(af == AF_INET ? "IPv4" : "IPv6"), ip);
return EINVAL;
}
return 0;
}
Reference resources
FastDFS6.0.6 Set up the cluster
Reference resources URL: http://www.luyixian.cn/news_show_381479.aspx
边栏推荐
- Upgrade appium automation framework to the latest 2.0
- [1]数学建模基础入门知识
- @ConstructorProperties注解理解以及其对应使用方式
- Click "Niuke | daily question" to eliminate it
- Is there any online account opening process of Huatai Securities? Is online account opening safe
- 【故障诊断】基于贝叶斯优化支持向量机的轴承故障诊断附matlab代码
- How to solve the crash when the easygbs platform edits the device management group?
- What is KVM? What is KVM virtual machine?
- Deep learning - CV, CNN, RNN
- Conda 虚拟环境envs目录为空
猜你喜欢

归并排序(merge_sort)

How to solve the crash when the easygbs platform edits the device management group?
![[untitled]](/img/42/5e8b62edc0aa289098425b26df2453.jpg)
[untitled]

少儿编程 电子学会图形化编程等级考试Scratch一级真题解析(选择题)2022年6月

CS5801_ HDMI to EDP advantage replaces lt6711a solution

What are the aspects of performance testing? What are the classification and testing methods?

【保姆级】包体积优化教程

排序问题:冒泡排序,选择排序,插入排序

曲线曲率展示

Uitoolkit tool template project
随机推荐
C#使用log4net插件,输出日志到文件
How to open an account online for Guohai Securities? Is it safe to open an account
Why the server is stuck
CS5801_HDMI转EDP优势替代LT6711A方案
C language introduction practice (8): switch case calculates the month, year and day of the next day (normal year / leap year calculation)
The "darkest hour" has not come yet. Cherish every bullet 2020-03-22
JVM class loading and GC garbage collection mechanism
Problems related to the use of ucharts (components) in uniapp
7. Reverse Integer整数反转
【C语言】文件操作
Experimental flags: --disable_ admission_ control=false --enable_ rm=false --llama_ callback_ port=28000
A tool for quickly switching local host files -- switchhosts
Three skills are needed to engage in SAP related work
Multi target detection
Upgrade appium automation framework to the latest 2.0
力扣5: 最长回文子串
『牛客|每日一题』点击消除
Find the original root
Conda 虚拟环境envs目录为空
【C语言】通讯录动态版和文件版