从Kafka的实时流entity_1、entity_3和relation_holding中获取数据,导入至嬴图数据库的图集shareholding中:
1. 生成配置文件模板
./ultipa-importer --sample
2. 修改配置文件
# 配置数据源类型
mode: kafka
# 配置数据源信息
kafka:
host: "192.168.1.1:5432"
# 配置嬴图服务器
server:
# 嬴图服务器,集群中的多个节点用英文逗号隔开
host: "192.168.2.149:60075"
username: "admin"
password: "abcd1234"
# 图集名,默认使用图集default
graphset: "shareholding"
# 用于远程通信的ssl证书文件的路径及名称,仅在双方均为ssl模式时有效
crt: ""
# 配置点数据的字段
nodeConfig:
- schema: "human"
topic: "entity_1"
offset: newest
properties:
- name: id
type: _id
- name: name
type: string
- name: type
type: _ignore
- schema: "firm"
topic: "entity_3"
offset: newest
properties:
- name: id
type: _id
- name: name
type: string
- name: type
type: _ignore
# 配置边数据的字段
edgeConfig:
- schema: "hold"
topic: "relation_holding"
offset: newest
properties:
- name: from
type: _from
- name: to
type: _to
- name: shareInt
type: int32
new_name: share
- name: type
type: _ignore
# 全局设置
settings:
batchSize: 10000
importMode: insert
# 自动创建图集、schema和属性
yes: true
3. 执行导入
./ultipa-importer --config ./import.sample.kafka.yml