在如下我使用的命令中:curl -i -X POST -H "Accept:application/json" -H "Content-Type:application/json" http://localhost:8083/connectors/ -d \ '{ "name": "postgres_connector", "config": { "connector.class": "io.debezium.connector.postgresql.PostgresConnector", "connector.displayName": "PostgreSQL", "database.user": "debe", "database.dbname": "postgres", "connector.id": "postgres", "database.server.name": "postgres_productor", "database.port": "15432", "plugin.name": "pgoutput", "table.whitelist": "z_series_computer,lpar,sysplex,zos,cics_region,cics_plex,cics_transaction,db2_data_sharing_group,db2_subsystem,db2_database,db2_stored_procedure,mq_subsystem,mq_alias_queue,mq_local_queue,mq_model_queue,mq_remote_queue,ims_subsystem,ims_database,ims_transaction,ims_sysplex_group", "mode": "incrementing", "topic.prefix": "postgres", "database.hostname": "192.168.64.143", "database.password": "123456", "name": "postgres_connector" } }',我在table.whitelist参数处的语法正确吗,我想要指定多个表,我把我想要的表都写在了一个“”中,并用逗号隔开
时间: 2023-08-10 18:09:21 浏览: 149
在你提供的命令中,你使用了`table.whitelist`参数来指定要监听的表。你将所需的表名都写在了一个字符串中,并用逗号隔开。这个做法是正确的,可以用来指定多个表。
例如,你的`table.whitelist`参数的值为:
```
"table.whitelist": "z_series_computer,lpar,sysplex,zos,cics_region,cics_plex,cics_transaction,db2_data_sharing_group,db2_subsystem,db2_database,db2_stored_procedure,mq_subsystem,mq_alias_queue,mq_local_queue,mq_model_queue,mq_remote_queue,ims_subsystem,ims_database,ims_transaction,ims_sysplex_group"
```
在这个例子中,你指定了19个表名,它们之间用逗号分隔。这样配置后,Kafka Connect将只监听这些表的变化,并将其写入Kafka主题。
所以,你在`table.whitelist`参数处的语法是正确的。确保表名的拼写正确,并且没有多余的空格或其他字符。另外,还要确保已经正确安装了Debezium PostgreSQL Connector并配置了正确的数据库连接信息。
希望这可以帮助到你!如果你还有其他问题,请随时提问。
相关问题
使用java如何實現以下請求curl -X POST -H 'Content-Type: application/json' -H 'Accept: application/json' -d '{ "grant_type": "client_credentials", "client_id": "YXA6i-Ak8Ol4Eei2l11ZjV-EAg", "client_secret": "YXA6VunqiNxoB7IwXHInk1cGiXOOJfc", "ttl": "1024000" }' 'http://a1.easemob.com/easemob-demo/testapp/token'
使用Java可以通过HttpURLConnection或者OkHttp库发送POST请求实现以下命令:
curl -X POST -H 'Content-Type: application/json' -H 'Accept: application/json' -d '{ "grant_type": "client_credentials", "client_id": "YXA6i-Ak8Ol4Eei2l11ZjV-EAg","client_secret": "YXA6VunqiNxoB7IwXHInk1cGiXOOJfc","ttl": "1024000" }' 'http://a1.easemob.com/easemob-demo/testapp/token'
示例代码:
使用HttpURLConnection发送POST请求:
```java
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
public class HttpPost {
public static void main(String[] args) throws Exception{
String url = "http://a1.easemob.com/easemob-demo/testapp/token";
URL obj = new URL(url);
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
//添加请求头
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Accept", "application/json");
//发送POST请求
con.setDoOutput(true);
DataOutputStream wr = new DataOutputStream(con.getOutputStream());
wr.writeBytes("{ \"grant_type\": \"client_credentials\", \"client_id\": \"YXA6i-Ak8Ol4Eei2l11ZjV-EAg\",\"client_secret\": \"YXA6VunqiNxoB7IwXHInk1cGiXOOJfc\",\"ttl\": \"1024000\" }");
wr.flush();
wr.close();
//读取响应
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
//打印响应结果
System.out.println(response.toString());
}
}
```
使用OkHttp库发送POST请求:
```java
import okhttp3.*;
import java.io.IOException;
public class OkHttpPost {
public static void main(String[] args) throws Exception{
String url = "http://a1.easemob.com/easemob-demo/testapp/token";
String json = "{ \"grant_type\": \"client_credentials\", \"client_id\": \"YXA6i-Ak8Ol4Eei2l11ZjV-EAg\",\"client_secret\": \"YXA6VunqiNxoB7IwXHInk1cGiXOOJfc\",\"ttl\": \"1024000\" }";
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, json);
Request request = new Request.Builder()
.url(url)
.post(body)
.addHeader("Content-Type", "application/json")
.addHeader("Accept", "application/json")
.build();
//发送POST请求
Response response = client.newCall(request).execute();
System.out.println(response.body().string());
}
}
```
curl -X POST -H "accept:*/*" -H "Content-Type: application/json" -d "{\"Title\":\"QQQ\"}" http://localhost:8080/todolist Invoke-WebRequest : 无法绑定参数“Headers”。无法将“System.String”类型的“accept:*/*”值转换为“System.Collections.IDictionary”类型。怎么办
这个问题的原因是 PowerShell 无法将字符串 "accept:*/*" 解析为正确的字典类型的 header。你需要将 header 作为字典类型传递给命令,可以使用以下命令解决这个问题:
```
$headers = @{ "accept" = "*/*"; "Content-Type" = "application/json" }
$body = @{ "Title" = "QQQ" } | ConvertTo-Json
Invoke-WebRequest -Uri http://localhost:8080/todolist -Method POST -Headers $headers -Body $body
```
这个命令将会创建一个字典类型的 `$headers` 变量,然后将其传递给 `Invoke-WebRequest` 命令。同时,我们还将请求体作为 JSON 格式的字符串放在 `$body` 变量中,并使用 `ConvertTo-Json` 命令将其转换为 JSON 格式。最后,我们将 `$headers` 和 `$body` 变量一起传递给 `Invoke-WebRequest` 命令。