-
Notifications
You must be signed in to change notification settings - Fork 0
/
commands.txt
174 lines (154 loc) · 6.57 KB
/
commands.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# Create DB users and grants
mysql -p -e "CREATE USER 'ukafka'@'%' identified by 'K*123456'"
mysql -p -e "GRANT ALL ON *.* TO 'ukafka'@'%'"
su postgres -c psql -c "CREATE ROLE ukafka LOGIN SUPERUSER PASSWORD 'K*123456'" postgres
# List all connectors
curl -H "Accept:application/json" http://pl18-kafka-con:8083/connectors/
# Connectors inventory
curl -i -X GET -H "Accept:application/json" http://pl18-kafka-con:8083/connectors/inventory-connector
# Connector configuration
curl http://pl18-kafka-con:8083/connectors/jdbc-sink | jq
# Status
curl http://pl18-kafka-con:8083/connectors/pl18_db-sink-employees/status | jq
# Restart the connector
curl -X POST http://pl18-kafka-con:8083/connectors/pl18_db-sink-departments/tasks/0/restart
# Remove connector
curl -X DELETE http://pl18-kafka-con:8083/connectors/pl18_db-sink-employees
curl -i -X POST -H "Accept:application/json" -H "Content-Type:application/json" http://pl18-kafka-con:8083/connectors/ -d '
{
"name": "pl18_db-sink-employees",
"config": {
"connector.class": "io.confluent.connect.jdbc.JdbcSinkConnector",
"tasks.max": "1",
"topics": "employees",
"connection.url": "jdbc:postgresql://pl18-pg1:5432/pl18_db?user=ukafka&password=K*123456",
"transforms": "unwrap",
"transforms.unwrap.type": "io.debezium.transforms.UnwrapFromEnvelope",
"auto.create": "true",
"insert.mode": "upsert",
"pk.fields": "emp_no",
"pk.mode": "record_value"
}
}'
curl -i -X POST -H "Accept:application/json" -H "Content-Type:application/json" http://pl18-kafka-con:8083/connectors/ -d '
{
"name": "pl18_db-sink-departments",
"config": {
"connector.class": "io.confluent.connect.jdbc.JdbcSinkConnector",
"tasks.max": "1",
"topics": "departments",
"connection.url": "jdbc:postgresql://pl18-pg1:5432/pl18_db?user=ukafka&password=K*123456",
"transforms": "unwrap",
"transforms.unwrap.type": "io.debezium.transforms.UnwrapFromEnvelope",
"auto.create": "true",
"insert.mode": "upsert",
"pk.fields": "dept_no",
"pk.mode": "record_value"
}
}'
curl -i -X POST -H "Accept:application/json" -H "Content-Type:application/json" http://pl18-kafka-con:8083/connectors/ -d '
{
"name": "pl18_db-sink-dept_manager",
"config": {
"connector.class": "io.confluent.connect.jdbc.JdbcSinkConnector",
"tasks.max": "1",
"topics": "dept_manager",
"connection.url": "jdbc:postgresql://pl18-pg1:5432/pl18_db?user=ukafka&password=K*123456",
"transforms": "unwrap",
"transforms.unwrap.type": "io.debezium.transforms.UnwrapFromEnvelope",
"auto.create": "true",
"insert.mode": "upsert",
"pk.fields": "emp_no,dept_no",
"pk.mode": "record_value"
}
}'
curl -i -X POST -H "Accept:application/json" -H "Content-Type:application/json" http://pl18-kafka-con:8083/connectors/ -d '
{
"name": "pl18_db-sink-dept_emp",
"config": {
"connector.class": "io.confluent.connect.jdbc.JdbcSinkConnector",
"tasks.max": "1",
"topics": "dept_emp",
"connection.url": "jdbc:postgresql://pl18-pg1:5432/pl18_db?user=ukafka&password=K*123456",
"transforms": "unwrap",
"transforms.unwrap.type": "io.debezium.transforms.UnwrapFromEnvelope",
"auto.create": "true",
"insert.mode": "upsert",
"pk.fields": "emp_no,dept_no",
"pk.mode": "record_value"
}
}'
curl -i -X POST -H "Accept:application/json" -H "Content-Type:application/json" http://pl18-kafka-con:8083/connectors/ -d '
{
"name": "pl18_db-sink-titles",
"config": {
"connector.class": "io.confluent.connect.jdbc.JdbcSinkConnector",
"tasks.max": "1",
"topics": "titles",
"connection.url": "jdbc:postgresql://pl18-pg1:5432/pl18_db?user=ukafka&password=K*123456",
"transforms": "unwrap",
"transforms.unwrap.type": "io.debezium.transforms.UnwrapFromEnvelope",
"auto.create": "true",
"insert.mode": "upsert",
"pk.fields": "emp_no,title, from_date",
"pk.mode": "record_value"
}
}'
curl -i -X POST -H "Accept:application/json" -H "Content-Type:application/json" http://pl18-kafka-con:8083/connectors/ -d '
{
"name": "pl18_db-sink-salaries",
"config": {
"connector.class": "io.confluent.connect.jdbc.JdbcSinkConnector",
"tasks.max": "1",
"topics": "salaries",
"connection.url": "jdbc:postgresql://pl18-pg1:5432/pl18_db?user=ukafka&password=K*123456",
"transforms": "unwrap",
"transforms.unwrap.type": "io.debezium.transforms.UnwrapFromEnvelope",
"auto.create": "true",
"insert.mode": "upsert",
"pk.fields": "emp_no, from_date",
"pk.mode": "record_value"
}
}'
curl -i -X POST -H "Accept:application/json" -H "Content-Type:application/json" http://pl18-kafka-con:8083/connectors/ -d '
{
"name": "pl18_db-connector",
"config": {
"connector.class": "io.debezium.connector.mysql.MySqlConnector",
"tasks.max": "1",
"database.hostname": "pl18-pxc1",
"database.port": "3306",
"database.user": "ukafka",
"database.password": "K*123456",
"database.server.id": "10001",
"database.server.name": "pl18-pxc-node1",
"database.whitelist": "pl18_db",
"database.history.kafka.bootstrap.servers": "pl18-kafka:9092",
"database.history.kafka.topic": "schema-changes.inventory",
"transforms": "route",
"transforms.route.type": "org.apache.kafka.connect.transforms.RegexRouter",
"transforms.route.regex": "([^.]+)\\.([^.]+)\\.([^.]+)",
"transforms.route.replacement": "$3"
}
}'
#### Change configuration
curl -X PUT -H "Content-Type: application/json" --data '
{
"connector.class": "io.debezium.connector.mysql.MySqlConnector",
"tasks.max": "1",
"database.hostname": "pl18-pxc1",
"database.port": "3306",
"database.user": "ukafka",
"database.password": "K*123456",
"database.server.id": "10001",
"database.server.name": "pl18-pxc-node1",
"database.whitelist": "employees",
"database.history.kafka.bootstrap.servers": "pl18-kafka:9092",
"database.history.kafka.topic": "schema-changes.inventory",
"transforms": "route",
"transforms.route.type": "org.apache.kafka.connect.transforms.RegexRouter",
"transforms.route.regex": "([^.]+)\\.([^.]+)\\.([^.]+)",
"transforms.route.replacement": "$3",
"name":"employees-connector"
}
' http://pl18-kafka-con:8083/connectors/employees-connector/config