物联网参数
xSQL 配置文件可用于定义与 C API 结构 mco_iot_comm_params_t 和 mco_iot_replicator_params_t 相对应的 IoT(主动复制)参数。
iot_params 部分由一组用大括号括起来的“名称 : 值”对组成。例如:
iot_params : {
agent_id: 10024,
listen_queue_size: 5,
...
}
以下表格列出了 iot_params 部分的可能选项,以及注释中指定的相应 C API 结构和值:
agent_id
agent_id: 10024,
此设备/服务器的标识;必须大于 0 且对于所有代理来说都是唯一的(也可以在模式中指定)
level
level : 100,
可能的值为“server”、“device”或 1 到 65535 之间的无符号整数。
enabled
enabled: false,
允许在启动时禁用物联网运行时。稍后可以使用 xsql_iot_enable() 用户定义函数启用物联网。(默认值为 true)
listen_queue_size
listen_queue_size : 5,
监听套接字队列的最大长度;默认值为 0(表示使用系统定义的最大值)
n_callback_threads
n_callback_threads : 16,
处理传入请求的线程数;默认值为 8 。
recv_timeout
recv_timeout : 2000,
recv() 操作的超时时间(以毫秒为单位);默认值为 10*1000(10 秒)
send_timeout
send_timeout : 2000,
send() 操作的超时时间(以毫秒为单位);默认值为 10*1000(10 秒)
wakeup_port
wakeup_port : 9900,
服务端口的端口号;默认值为 0(表示使用系统定义的端口号)
conn_pool_size
conn_pool_size : 16,
缓存数据库连接的最大数量;默认值为(回调线程数 + 2)
sync_type
sync_type : "pull",
自动同步的类型(请参阅下面的 sync_on_connect 和 sync_period)。可以是 push(发送传出数据)、pull(请求传入数据)或 sync(同时进行 push 和 pull);这是默认值。
clear_on_ack
clear_on_ack : false,
是否移除已发送至接收方并获得确认的传出数据;默认值为 false 。
sync_on_connect
sync_on_connect : true,
在建立连接后是否立即执行同步(sync_type 定义了复制的方向);默认值为 false
sync_period
sync_period : 120000,
以毫秒为单位的自动同步数据的时间间隔(sync_type 定义了复制的方向);默认值为 0(禁用自动复制)
compression_level
所有客户端的全局压缩级别(除非在连接部分另有指定):0 = 不压缩;1 = 最佳速度;9 = 最佳压缩。默认值为 0 。
connections
connections : [ {...}, ],
连接器阵列:
# Type of connection, 'listen' (default) or 'connect'
type : "listen",
# IoT runtiime enabled at startup (default is true)
enabled : false,
# Network address to connect or listen on
address : "127.0.0.1:5000",
# Timeout for connect() operation in milliseconds
# (has sense only for 'type' == "connect").
# Default value is 2000 (2 seconds)
connect_timeout : 2000,
# Interval between connect() operations in milliseconds
# (has sense only for 'type' == "connect").
# Default value is 60*1000 (1 minute)
connect_interval : 10000,
# Use local (UNIX) socket domain. Default value 'false'
local_sockets : false,
# SSL parameters. If this section is not specified,
# SSL is not used for the connection. To inherit the
# global ssl_params settings, leave the ssl_params
# section empty.
ssl_params : {... }
# Override global compression level for this connection
compression_level : 0,