YMatrix 文档
关于 YMatrix
标准集群部署
数据写入
SQL 参考
- ABORT
- ALTER_DATABASE
- ALTER_EXTENSION
- ALTER_EXTERNAL_TABLE
- ALTER_FOREIGN_DATA_WRAPPER
- ALTER_FOREIGN_TABLE
- ALTER_FUNCTION
- ALTER_INDEX
- ALTER_RESOURCE_GROUP
- ALTER_RESOURCE_QUEUE
- ALTER_ROLE
- ALTER_RULE
- ALTER_SCHEMA
- ALTER_SEQUENCE
- ALTER_SERVER
- ALTER_TABLE
- ALTER_TABLESPACE
- ALTER_TYPE
- ALTER_USER_MAPPING
- ALTER_VIEW
- ANALYZE
- BEGIN
- CHECKPOINT
- COMMIT
- COPY
- CREATE_DATABASE
- CREATE_EXTENSION
- CREATE_EXTERNAL_TABLE
- CREATE_FOREIGN_DATA_WRAPPER
- CREATE_FOREIGN_TABLE
- CREATE_FUNCTION
- CREATE_INDEX
- CREATE_RESOURCE_GROUP
- CREATE_RESOURCE_QUEUE
- CREATE_ROLE
- CREATE_RULE
- CREATE_SCHEMA
- CREATE_SEGMENT_SET
- CREATE_SEQUENCE
- CREATE_SERVER
- CREATE_TABLE
- CREATE_TABLE_AS
- CREATE_TABLESPACE
- CREATE_TYPE
- CREATE_USER_MAPPING
- CREATE_VIEW
- DELETE
- DROP_DATABASE
- DROP_EXTENSION
- DROP_EXTERNAL_TABLE
- DROP_FOREIGN_DATA_WRAPPER
- DROP_FOREIGN_TABLE
- DROP_FUNCTION
- DROP_INDEX
- DROP_RESOURCE_GROUP
- DROP_RESOURCE_QUEUE
- DROP_ROLE
- DROP_RULE
- DROP_SCHEMA
- DROP_SEGMENT_SET
- DROP_SEQUENCE
- DROP_SERVER
- DROP_TABLE
- DROP_TABLESPACE
- DROP_TYPE
- DROP_USER_MAPPING
- DROP_VIEW
- END
- EXPLAIN
- GRANT
- INSERT
- LOAD
- LOCK
- REINDEX
- RELEASE_SAVEPOINT
- RESET
- REVOKE
- ROLLBACK_TO_SAVEPOINT
- ROLLBACK
- SAVEPOINT
- SELECT INTO
- SET ROLE
- SET TRANSACTION
- SET
- SHOW
- START TRANSACTION
- TRUNCATE
- UPDATE
- VACUUM
MatrixGate 快速上手
本文档介绍了 MatrixGate 的基本使用方法,包含以下内容:
1 生成 mxgate 配置文件
首先,你需要指定目标数据库和目标表,以生成 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 的加载做些个性化定制,同时也可以使用全局缺省设置往其他表中加载数据。
2 修改 mxgate 配置文件(可选)
根据需要修改 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
3 启动 mxgate
启动 mxgate,加载配置文件,连接 demo 数据库,准备接收数据加载请求。
[mxadmin@mdw ~]$ mxgate start --config mxgate.conf
4 查看后台服务状态
[mxadmin@mdw ~]$ mxgate status
5 终止后台服务
[mxadmin@mdw ~]$ mxgate stop
当遇到超时或者其他问题需要强制停止时,可以这样执行:
[mxadmin@mdw ~]$ mxgate stop --force
注意!
MatrixGate 完整的命令行参数信息请见 MatrixGate 命令行参数;主要功能介绍请见 MatrixGate 主要功能。