fastdfs配置外网应用访问内网fastdfs服务器
当集成fastdfs-client后,将应用配置到阿里云上面,fastdfs服务器在内网,然后配置fdfs.tracker-list为外网ip, 但是23000端口还是读取到了内网IP.
com.github.tobato.fastdfs.proto.AbstractFdfsCommand.send(AbstractFdfsCommand.java:74) - 发出交易请求..报文头为ProtoHead [contentLength=0, cmd=101, status=0]
[17:16:41:037] [DEBUG] - com.github.tobato.fastdfs.proto.AbstractFdfsCommand.send(AbstractFdfsCommand.java:75) - 交易参数为[]
[17:16:41:050] [DEBUG] - com.github.tobato.fastdfs.proto.AbstractFdfsCommand.receive(AbstractFdfsCommand.java:99) - 服务端返回报文头ProtoHead [contentLength=40, cmd=100, status=0]
[17:16:41:053] [DEBUG] - com.github.tobato.fastdfs.proto.mapper.ObjectMataData.dumpObjectMataData(ObjectMataData.java:201) - dump class=com.github.tobato.fastdfs.domain.StorageNode
[17:16:41:053] [DEBUG] - com.github.tobato.fastdfs.proto.mapper.ObjectMataData.dumpObjectMataData(ObjectMataData.java:202) - ----------------------------------------
[17:16:41:054] [DEBUG] - com.github.tobato.fastdfs.proto.mapper.ObjectMataData.dumpObjectMataData(ObjectMataData.java:204) - FieldMataData [field=groupName, index=0, max=16, size=16, offsize=0]
[17:16:41:054] [DEBUG] - com.github.tobato.fastdfs.proto.mapper.ObjectMataData.dumpObjectMataData(ObjectMataData.java:204) - FieldMataData [field=ip, index=1, max=15, size=15, offsize=16]
[17:16:41:054] [DEBUG] - com.github.tobato.fastdfs.proto.mapper.ObjectMataData.dumpObjectMataData(ObjectMataData.java:204) - FieldMataData [field=port, index=2, max=0, size=8, offsize=31]
[17:16:41:054] [DEBUG] - com.github.tobato.fastdfs.proto.mapper.ObjectMataData.dumpObjectMataData(ObjectMataData.java:204) - FieldMataData [field=storeIndex, index=3, max=0, size=1, offsize=39]
[17:16:41:055] [DEBUG] - com.github.tobato.fastdfs.proto.mapper.FdfsParamMapper.mapByIndex(FdfsParamMapper.java:94) - 设置值是 FieldMataData [field=groupName, index=0, max=16, size=16, offsize=0]group1
[17:16:41:087] [DEBUG] - org.apache.commons.beanutils.ConvertUtilsBean.convert(ConvertUtilsBean.java:418) - Convert string 'group1' to class 'java.lang.String'
[17:16:41:089] [DEBUG] - com.github.tobato.fastdfs.proto.mapper.FdfsParamMapper.mapByIndex(FdfsParamMapper.java:94) - 设置值是 FieldMataData [field=ip, index=1, max=15, size=15, offsize=16]192.168.99.223
[17:16:41:089] [DEBUG] - org.apache.commons.beanutils.ConvertUtilsBean.convert(ConvertUtilsBean.java:418) - Convert string '192.168.99.223' to class 'java.lang.String'
[17:16:41:089] [DEBUG] - com.github.tobato.fastdfs.proto.mapper.FdfsParamMapper.mapByIndex(FdfsParamMapper.java:94) - 设置值是 FieldMataData [field=port, index=2, max=0, size=8, offsize=31]23000
[17:16:41:090] [DEBUG] - org.apache.commons.beanutils.ConvertUtilsBean.convert(ConvertUtilsBean.java:418) - Convert string '23000' to class 'int'
[17:16:41:090] [DEBUG] - com.github.tobato.fastdfs.proto.mapper.FdfsParamMapper.mapByIndex(FdfsParamMapper.java:94) - 设置值是 FieldMataData [field=storeIndex, index=3, max=0, size=1, offsize=39]0
[17:16:41:090] [DEBUG] - org.apache.commons.beanutils.ConvertUtilsBean.convert(ConvertUtilsBean.java:418) - Convert string '0' to class 'byte'
[17:16:41:092] [DEBUG] - com.github.tobato.fastdfs.conn.DefaultConnection.
storage.conf上配置了外网也不会生效,只会读取storage本机内网地址的
自 V4.03 版本开始支持使用 storage_ids.conf 中的 id 解决,在 tracker.conf 有以下配置:
# 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 = true
# specify storage ids filename, can use relative or absolute path
# this parameter is valid only when use_storage_id set to true
# since V4.00
storage_ids_filename = storage_ids.conf
# id type of the storage server in the filename, values are:
## ip: the ip address of the storage server
## id: the server id of the storage server
# this paramter is valid only when use_storage_id set to true
# default value is ip
# since V4.03
id_type_in_filename = id
我用的 V6.07 版本,配置了多个 IP 地址,测试云上和本地都可以正常上传下载。