当前位置:网站首页>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
边栏推荐
- 『期末复习』16/32位微处理器(8086)基本寄存器
- dev treelist 常用用法小结
- 抖音web端 s_v_web_id 参数生成分析与实现
- [Web3 series development tutorial - create your first NFT (4)] what can NFTs bring to you
- 力扣——3. 无重复字符的最长子串
- 打开服务器上的 IncludeExceptionDetailInFaults (从 ServiceBehaviorAttribute 或从 &lt;serviceDebug&gt; 配置行为)以便将异常信息发送回
- [image denoising] image denoising based on bicube interpolation and sparse representation matlab source code
- Which "digital currencies" can survive this winter? 2020-03-30
- 力扣5: 最长回文子串
- 『HarmonyOS』DevEco的下载安装与开发环境搭建
猜你喜欢

Merge_sort

Multi target detection

The "darkest hour" has not come yet. Cherish every bullet 2020-03-22

Find the original root

Download, installation and development environment construction of "harmonyos" deveco

Upgrade appium automation framework to the latest 2.0

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

归并排序(merge_sort)
![Rust语言- Slice(切片)类型(&[u8])](/img/d1/68c73c8b34b848212083c08df3137f.png)
Rust语言- Slice(切片)类型(&[u8])

PG vacuum auto vacuum
随机推荐
TCP protocol -- message format, connection establishment, reliable transmission, congestion control
Use and analysis of show profile optimized by MySQL
堆排序(heap-sort)
"Final review" 16/32-bit microprocessor (8086) basic register
【C语言】通讯录动态版和文件版
Vim中删除^M
[image denoising] image denoising based on bicube interpolation and sparse representation matlab source code
Torth file read vulnerability (cnvd-2020-27769)
The creation of "harmonyos" project and the use of virtual machines
[pytorch] fine tuning technology
C language introduction practice (8): switch case calculates the month, year and day of the next day (normal year / leap year calculation)
排序问题:冒泡排序,选择排序,插入排序
Resume considerations
PMP customs formula, don't hurry to recite it
『牛客|每日一题』点击消除
深度学习——CV、CNN、RNN
Basis of multimodal semantic segmentation
[image hiding] digital image watermarking method technology based on hybrid dwt-hd-svd with matlab code
Why use the static keyword when defining methods
输入5个学生的记录(每条记录包括学号和成绩), 组成记录数组, 然后按照成绩由高到低的次序输出. 排序方法采用选择排序