400-800-0824
info@ymatrix.cn
400-800-0824
info@ymatrix.cn
400-800-0824
info@ymatrix.cn
400-800-0824
info@ymatrix.cn
400-800-0824
info@ymatrix.cn
YMatrix 文档
关于 YMatrix
标准集群部署
数据写入
数据迁移
数据查询
运维监控
参考指南
工具指南
数据类型
存储引擎
执行引擎
系统配置参数
SQL 参考
常见问题(FAQ)
本文档介绍了 MatrixGate 的基本使用方法,包含以下内容:
首先,你需要指定目标数据库和目标表,以生成 mxgate 配置文件。本文以三节点集群为例,主节点(Master)为 mdw,数据节点分别为 sdw1,sdw2。
[mxadmin@mdw ~]$mxgate config --db-database demo --target public.testtable --target public.testtable2 --allow-dynamic > mxgate.conf
上述参数将生成一个配置文件 mxgate.conf,你可对 testtable 和 testtable2 的加载做些个性化定制,同时也可以使用全局缺省设置往其他表中加载数据。
根据需要修改 mxgate 配置文件,如配置数据分隔符等,选择默认配置可忽略此步骤。可以在该配置文件中看到与 testtable 和 testtable2 对应的设置如下:
[[job.target]]
# delimiter = "|"
# exclude-columns = []
# format = "text"
name = "job_text_to_public.testtable"
# null-as = ""
table = "public.testtable"
# time-format = "unix-second"
# use-auto-increment = true
[[job.target]]
# delimiter = "|"
# exclude-columns = []
# format = "text"
name = "job_text_to_public.testtable2"
# null-as = ""
table = "public.testtable2"
# time-format = "unix-second"
# use-auto-increment = true
如果 testtable 的分隔符是 @,而 testtable2 的分隔符是 %,可以把上述配置修改为:
[[job.target]]
delimiter = "@"
# exclude-columns = []
# format = "text"
name = "job_text_to_public.testtable"
# null-as = ""
table = "public.testtable"
# time-format = "unix-second"
# use-auto-increment = true
[[job.target]]
delimiter = "%"
# exclude-columns = []
# format = "text"
name = "job_text_to_public.testtable2"
# null-as = ""
table = "public.testtable2"
# time-format = "unix-second"
# use-auto-increment = true
mxgate 默认监听 8086 端口接收数据,可以在 mxgate.conf 中看到 source.http 下的 http-port 子项设置为 8086,如果需要,可以改为其他端口:
[source]
## Source plugin is the data entrance to MatrixGate
## Types restricted to: http
source = "http"
[source.http]
## Port of http push
# http-port = 8086
## Maximum request body size (after gzip)
## The server rejects requests with bodies exceeding this limit.
# max-body-bytes = 4194304
## The maximum number of concurrent HTTP connections to the server
## The server response with 503 after exceed this limit.
# max-concurrency = 40000
启动 mxgate,加载配置文件,连接 demo 数据库,准备接收数据加载请求。
[mxadmin@mdw ~]$ mxgate start --config mxgate.conf
[mxadmin@mdw ~]$ mxgate status
[mxadmin@mdw ~]$ mxgate stop
当遇到超时或者其他问题需要强制停止时,可以这样执行:
[mxadmin@mdw ~]$ mxgate stop --force
注意!
MatrixGate 完整的命令行参数信息请见 MatrixGate 命令行参数;主要功能介绍请见 MatrixGate 主要功能。