首批通过分布式安全可靠测评,为关键业务系统打造
配置参数
更新时间:2025-05-30 16:16:38
本地配置
本地配置存储在 conf/conf.json 文件中,主要有以下参数。
| 参数 | 默认值 | 说明 |
|---|---|---|
| service_port | 2983 | 服务监听端口 |
| max_packet_bytes | 67108864 | 最大数据包字节数 |
| record_queue_size | 20000 | 数据发送队列大小 |
| read_timeout_us | 2000000 | 数据读取队列批次等待周期,单位:微秒 |
| read_fail_interval_us | 1000000 | 数据读取队列重试等待周期,单位:微秒 |
| read_wait_num | 20000 | 数据读取队列批次等待数量 |
| send_timeout_us | 2000000 | 发送数据包超时时间,单位:微秒 |
| send_fail_interval_us | 1000000 | 发送数据包失败重试等待周期,单位:微秒 |
| command_timeout_s | 10 | 命令执行超时时间,单位:微秒 |
| log_quota_size_mb | 5120 | 日志文件总大小阈值,单位:MB |
| log_quota_day | 7 | 日志文件保存时间阈值,单位:天 |
| log_gc_interval_s | 43200 | 日志文件清理周期,单位:秒 |
| log_level | 2 | 日志级别,从低到高依次为 0(trace)、1(debug)、2(info)、3(warn)、4(error)、5(critical) |
| log_flush_strategy | 1 | 日志刷新策略,可选值为 1(基于日志级别刷新)和 0(基于时间周期刷新) |
| log_flush_level | 2 | 日志刷新等级 |
| log_flush_period_s | 1 | 日志刷新周期,单位:秒 |
| log_max_file_size_mb | 1024 | 主进程 logproxy.log 的日志轮转大小,单位:MB |
| log_retention_h | 360 | 主进程 logproxy.log 的日志保留时间,单位:小时 |
| allow_all_tenant | true | 控制是否允许订阅所有租户 |
| ob_sys_username | "" | 系统租户用户名密文 |
| ob_sys_password | "" | 系统租户密码密文 |
| counter_interval_s | 2 | 计数器周期,单位:秒 |
| metric_enable | true | 控制是否开启指标采集(资源消耗:CPU、内存、网络) |
| metric_interval_s | 10 | 指标采集周期 |
| prometheus_port | 2984 | Prometheus 端口 |
| debug | false | 控制是否打印调试信息 |
| verbose | false | 控制是否打印详细信息 |
| verbose_packet | false | 控制是否打印数据包详细信息 |
| verbose_record_read | false | 控制是否打印记录读取详细信息 |
| count_record | false | 控制是否记录数量 |
| binlog_log_bin_basename | ./run | binlog 文件生成的默认路径 |
| binlog_obcdc_ce_path_template | ../../obcdc/obcdc-ce-%s.x-access/libobcdcaccess.so | binlog 依赖 obcdc 库路径模板 |
| binlog_ignore_unsupported_event | true | 控制是否跳过不支持转换的 event |
| binlog_max_event_buffer_bytes | 67108864 | binlog 事件转换缓冲区大小 |
| binlog_mode | false | 控制是否开启 binlog 模式 |
| binlog_nof_work_threads | 16 | 处理非 BC 调度请求的线程池大小,比如处理 binlog 查询相关,show binary logs 等 |
| binlog_bc_work_threads | 2 | BC 调度请求的线程池大小 |
| binlog_max_file_size_bytes | 536870912 | 单个 binlog 文件的大小阈值 |
| binlog_convert_timeout_us | 10000 | binlog 转换超时时间,单位:微秒 |
| binlog_checksum | true | 控制是否开启 binlog checksum |
| binlog_heartbeat_interval_us | 1000000 | binlog 心跳事件发送周期,单位:微秒 |
| binlog_gtid_display | true | 控制是否展示 GTID 信息 |
| binlog_ddl_convert | true | 控制是否开启 DDL 转换,开启时会丢弃 OceanBase 数据库的扩展语法。 |
| binlog_ddl_convert_ignore_unsupported_ddl | true | 控制是否忽略不支持转换的 ddl |
| binlog_memory_limit | 3G | binlog 内存限制,默认为 3G |
| binlog_working_mode | storage | binlog 工作模式,默认为 storage,对应 obcdc 的配置参数 working_mode |
| binlog_recover_backup | true | 控制是否开启 binlog 备份恢复 |
| start_tcp_port | 8100 | Binlog 实例占用端口的起始数值 |
| reserved_ports_num | 256 | 保留端口数量 |
| gtid_seq_compressed_interval_s | 256 | gtid seq 压缩周期,单位:秒 |
| gtid_seq_compressed_trx_size | 100000 | gtid seq 事务大小 |
| gtid_inspector_s | true | gtid 一致性巡检周期 |
| database_ip | MetaDB IP 地址 | |
| database_port | MetaDB 端口 | |
| database_name | MetaDB 数据库名 | |
| user | MetaDB 登陆用户 | |
| password | MetaDB 登陆密码 | |
| node_ip | 本机 IP 地址 | |
| enable_resource_check | true | 开启资源检查 |
| node_cpu_limit_threshold_percent | 80 | CPU 检测阈值 |
| node_mem_limit_threshold_percent | 85 | 内存检测阈值 |
| node_disk_limit_threshold_percent | 70 | 磁盘检测阈值 |
| recovery_point_strategy | fast | OBI 异节点拉起时恢复策略 |
| enable_dumper_interception | false | 控制是否开启订阅拦截 |
| max_dumper_num | 128 | OBI 最大接入订阅数量 |
元数据库配置
元数据库中有以下表:
| 表名 | 存储内容 |
|---|---|
| binlog_instances | 所有 Binlog Instance 的信息。 |
| config_template | 配置参数,对应单机版的 conf.json 文件。 |
| instances_gtid_seq | 所有 Binlog Instance 的 gtid 记录。 |
| nodes | 所有的 Binlog Server 节点信息。 |
| primary_instance | 所有的主 Binlog Instance 基本信息。 |
| tasks | 对 Binlog Instance 的操作记录,任务类型包括:0(创建)、1(删除)、2(停止)、3(启动)、4(恢复)。 |
| user | 组件间鉴权使用的账密信息。 |
这些表中,除了 config_template 之外,一般不需要手动进行修改。
config_template 表中主要有以下属性。
说明
当
config_template表中存在与conf/conf.json不一致的配置时,将以config_template表中的值为准。下表 bool 类型的属性中,取值
0代表false,1代表true。
| 属性 | 默认值 | 说明 |
|---|---|---|
| binlog_expire_logs_seconds | 259200 | binlog 文件过期时间,单位:秒 |
| binlog_expire_logs_size | 53687091200 | binlog 文件过期大小,单位:byte |
| auto_start_obcdc | 1 | 控制在 binlog 实例启动后,是否自动开启 obcdc 进行日志拉取 |
| active_state_after_boot | 0 | 控制 binlog 实例启动后,该实例是否处于 active(可对外提供服务)状态 |
| failover | 1 | 控制是否开启该 binlog 实例本身的故障恢复。若开启,当所在机器节点本身正常但 binlog 实例故障时,该 binlog 实例将被自动恢复 |
| binlog_gtid_display | true | 控制是否展示 GTID 信息 |
| binlog_ddl_convert | true | 控制是否开启 DDL 转换,转换会丢弃 OceanBase 数据库的超集语法 |
| binlog_memory_limit | 4G | obcdc 的内存使用上限,对应 obcdc 的配置参数 memory_limit |
| binlog_working_mode | storage | obcdc 的工作模式,对应 obcdc 的配置参数 working_mode |
| binlog_recover_backup | true | 控制是否开启 binlog 备份恢复 |
| gtid_seq_compressed_interval_s | 10 | gtid seq 压缩周期 |
| gtid_seq_compressed_trx_size | 100000 | gtid seq 事务大小 |
| gtid_marking_step_size | 100000 | gtid 标记步长 |
| gtid_inspector_s | 900 | gtid 一致性巡检周期,单位:秒 |
| gtid_memory_cache_seconds | 7200 | gtid 在内存中缓存的时间,单位:秒 |
| gtid_heartbeat_duration_s | 3600 | gtid 心跳周期,单位:秒 |
| recovery_point_strategy | fast | OBI 异节点拉起时恢复策略 |
| max_binlog_size | 536870912 | 单个 binlog 文件最大大小,单位:字节 |
| binlog_log_heartbeat_interval_times | 10 | 在运行日志中打印心跳信息的周期个数 |
| verbose_record_read | false | 控制是否打印记录读取详细信息 |
| binlog_ignore_unsupported_event | true | 控制是否跳过不支持转换的 event |
| binlog_max_event_buffer_bytes | 67108864 | binlog events 转换的 buffer 大小 |
| binlog_convert_timeout_us | 10000 | 转换超时时间,单位:微秒 |
| enable_resource_check | true | 控制是否开启资源检查 |
| node_cpu_limit_threshold_percent | 80 | CPU 检测阈值百分比 |
| node_mem_limit_threshold_percent | 85 | 内存检测阈值百分比 |
| node_disk_limit_threshold_percent | 70 | 磁盘检测阈值百分比 |
| enable_dumper_interception | false | 控制是否开启订阅拦截 |
| max_dumper_num | 128 | OBI 最大接入订阅数量 |
| default_instance_replicate_num | 1 | 创建 OBI 时的默认副本数 |
| max_task_execution_time_s | 600 | 任务最大执行时间,单位:秒 |
| default_defer_drop_sec | 0 | |
| binlog_ddl_convert_ignore_unsupported_ddl | true | 控制是否忽略不支持转换的 ddl |
| prometheus_unused_metric_clear_interval_s | 900 | 未使用的 metric 清理周期,单位:秒 |
| enable_auth | false | 控制是否开启 OBM 与 OBI 之间的连接鉴权 |
上述属性均可以通过 SQL 直接对某个属性进行修改,如通过以下 SQL 关闭资源使用率检查。
UPDATE config_template SET value='false' WHERE key_name='enable_resource_check';
修改完成后,需要重启 Binlog Server 节点以使变更生效。
# 非 supervisord 重启
./run.sh stop
./run.sh start
# supervisord 重启
supervisorctl restart binlog
说明
上述重启操作不会影响正在运行的 Binlog Instance。