我有两个引擎:postgres.properties(主节点)和azure.properties。两者都在同一台机器上。一个数据库是本地的,一个是在云中。
当SymmetricDS启动时,它会为天蓝色引擎提供此错误:
2018-06-05 06:49:30,476 WARN [azure] [JdbcSqlTemplate] [symmetric-engine-startup-1] CREATE TABLE permission denied in database 'master'.. Failed to execute: CREATE TABLE "sym_channel"(
"channel_id" VARCHAR(128) NOT NULL,
"processing_order" INT DEFAULT 1 NOT NULL,
"max_batch_size" INT DEFAULT 1000 NOT NULL,
"max_batch_to_send" INT DEFAULT 60 NOT NULL,
"max_data_to_route" INT DEFAULT 100000 NOT NULL,
"extract_period_millis" INT DEFAULT 0 NOT NULL,
"enabled" SMALLINT DEFAULT 1 NOT NULL,
"use_old_data_to_route" SMALLINT DEFAULT 1 NOT NULL,
"use_row_data_to_route" SMALLINT DEFAULT 1 NOT NULL,
"use_pk_data_to_route" SMALLINT DEFAULT 1 NOT NULL,
"reload_flag" SMALLINT DEFAULT 0 NOT NULL,
"file_sync_flag" SMALLINT DEFAULT 0 NOT NULL,
"contains_big_lob" SMALLINT DEFAULT 0 NOT NULL,
"batch_algorithm" VARCHAR(50) DEFAULT 'default' NOT NULL,
"data_loader_type" VARCHAR(50) DEFAULT 'default' NOT NULL,
"description" VARCHAR(255),
"queue" VARCHAR(25) DEFAULT 'default' NOT NULL,
"max_network_kbps" DECIMAL(10,3) DEFAULT 0.000 NOT NULL,
"data_event_action" CHAR(1),
"create_time" DATETIME,
"last_update_by" VARCHAR(50),
"last_update_time" DATETIME,
PRIMARY KEY ("channel_id")
)
这是因为'主人'数据库是read-only in Azure SQL databases。在此之后,[azure]节点关闭。
INFO [azure] [AbstractSymmetricEngine] [symmetric-engine-startup-1]停止SymmetricDS externalId = 001 version = 3.9.7 database = Microsoft SQL Server
..然后[postgres]节点对此有所说明:
WARN [postgres] [PushService] [postgres-push-default-3]无法推送到节点' 001'在小组' azure'。同步网址为空
为两个引擎设置了同步网址和注册网址,因此我认为真正的问题在于权限问题。
如何解决此错误? 我假设我需要指示SymmetricDS使用除#master;'以外的数据库,但是如何使用?
postgres.properties
engine.name=postgres
db.driver=org.postgresql.Driver
# The JDBC URL used to connect to the database
db.url=jdbc:postgresql://127.0.0.1/<redacted>
# The user to login as who can create and update tables
db.user=<redacted>
# The password for the user to login as
db.password=<redacted>
registration.url=
sync.url=http://localhost:31415/sync/postgres-000
# Do not change these for running the demo
group.id=postgres
external.id=000
# Don't muddy the waters with purge logging
job.purge.period.time.ms=7200000
# This is how often the routing job will be run in milliseconds
job.routing.period.time.ms=5000
# This is how often the push job will be run.
job.push.period.time.ms=10000
# This is how often the pull job will be run.
job.pull.period.time.ms=10000
# Kick off initial load
initial.load.create.first=true
azure.properties
engine.name=azure
db.driver=com.microsoft.sqlserver.jdbc.SQLServerDriver # located in the libs folder
# The JDBC URL used to connect to the database
db.url=jdbc:jtds:sqlserver://<redacted>
# The user to login as who can create and update tables
db.user=<redacted>
# The password for the user to login as
db.password=<redacted>
sync.url=http://localhost:31415/sync/azure-001
registration.url=http://localhost:31415/sync/postgres-000
group.id=azure
external.id=001
# This is how often the routing job will be run in milliseconds
job.routing.period.time.ms=5000
# This is how often the push job will be run.
job.push.period.time.ms=10000
# This is how often the pull job will be run.
job.pull.period.time.ms=10000
答案 0 :(得分:0)
在文件public static String RSADecryption(Key key, String base64EncryptedData) throws Exception {
Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding");
cipher.init(Cipher.DECRYPT_MODE, key);
byte[] a = Base64.decode(base64EncryptedData, Base64.DEFAULT);
byte[] plainBytes = cipher.doFinal(a);
return new String(plainBytes, "UTF-8");
}
public static String RSAEncryption(Key key, String plainData) throws Exception {
Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding");
cipher.init(Cipher.ENCRYPT_MODE, key);
byte[] a = plainData.getBytes();
byte[] encryptedBytes = cipher.doFinal(a);
return Base64.encodeToString(encryptedBytes, Base64.DEFAULT);
}
中,azure.properties
行已注释掉:
sync.url
经验法则是symmetricDs代理应该尽可能接近它同步的数据库。应该有一个对称-ds代理程序靠近主节点运行,另一个代理程序靠近azure实例运行。您将无法同步只读数据库。 SymmetricDs需要写/读,甚至创建表,函数,包和触发器权限才能正常工作