YMatrix 文档
关于 YMatrix
标准集群部署
数据写入
数据迁移
数据查询
运维监控
参考指南
- MPP 架构
- 镜像分布策略
- 持续聚集
- 滑动窗口
- Grafana 监控指标解读
- Prometheus 监控指标解读
- 术语表
-
工具指南
- mxaddmirrors
- mxbackup
- mxbench
- mxdeletesystem
- mxgate
- mxinitstandby
- mxmoveseg
- mxpacklogs
- mxrecover
- mxrestore
- mxshift
- mxstart
- mxstate
- mxstop
- gpconfig
- pgvector
-
数据类型
-
存储引擎
-
执行引擎
-
系统配置参数
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
常见问题(FAQ)
PXF 访问 SQL Server
本示例演示如何使用 PXF 连接 SQLServer 2016
1. PXF 安装
sudo yum install pxf-matrixdb3-5.16.1-1.el7.x86_64.rpm -y
sudo mkdir /usr/local/pxfconf
sudo chown mxadmin.mxadmin -R /usr/local/pxfconf
sudo chown mxadmin.mxadmin -R /usr/local/pxf-matrixdb4
export PXF_HOME=/usr/local/pxf-matrixdb4
export PXF_CONF=/usr/local/pxfconf
export PATH=$PXF_HOME/bin:$PATH
cd $PXF_CONF/servers
mkdir sqlserv_server
2. 配置
初始化 PXF:
pxf cluster init
从https://docs.microsoft.com/en-us/sql/connect/jdbc/using-the-jdbc-driver?view=sql-server-ver15 下载 jdbc 驱动: sqljdbc4.jar 将驱动放入 PXF 库目录(所有节点都需要):
cp sqljdbc4.jar $PXF_CONF/lib
同步配置到其它节点:
pxf cluster sync
3. 启动并查看集群状态
启动节点:
pxf cluster start
查看集群状态:
pxf cluster status
4. 访问
创建插件:
postgres=# CREATE EXTENSION pxf_fdw ;
CREATE EXTENSION
定义 SERVER:
DROP SERVER sqlserv_server cascade;
CREATE SERVER sqlserv_server FOREIGN DATA WRAPPER jdbc_pxf_fdw OPTIONS (
jdbc_driver 'com.microsoft.sqlserver.jdbc.SQLServerDriver',
db_url 'jdbc:sqlserver://{ip}:{端口};databaseName={数据库名}',
batch_size '10000',
fetch_size '2000'
);
创建用户映射:
CREATE USER MAPPING FOR mxadmin SERVER sqlserv_server OPTIONS ( user '{用户名}' , pass '{密码}');
创建外部表:
CREATE FOREIGN TABLE foreign_sqlserver (
id int4 ,
banzu varchar(20) ,
banzu_name varchar(50) ,
realdate timestamp
)
SERVER sqlserv_server
OPTIONS (resource '{源数据库schema.表名}');
通过外部表访问SQL Server数据:
SELECT * FROM foreign_sqlserver limit 10;