-
Notifications
You must be signed in to change notification settings - Fork 8.8k
Multi configuration Isolation
xingfudeshi edited this page Sep 3, 2019
·
13 revisions
Seata supports Multi-configuration Isolation since 0.6.1,You can configure it in the following steps.
Note that,the name of environment has been changed currently,will be release in next vererion(after 0.8.0).if you are building seata locally,please be ware of these changes.and these changes are showing below:
For JVM parameter:
BEFORE AFTER
seataConfigEnv -> seataEnv
For system variable:
BEFORE AFTER
SEATA_CONFIG_ENV -> SEATA_ENV
Suppose we now have a test environment in which we want to read only the configuration items corresponding to the test environment.
Seata provides two ways to set up different environments:
- -DseataEnv=test,where test is the name of the environment.
e.g.(Linux)
sh seata-server.sh -DseataEnv=test
- Use SEATA_ENV as the key of environment variable,and it's value will be the name of the environment.[recommended]
e.g.(Linux)
#vi /etc/profile
export SEATA_ENV=test
:wq
#source /etc/profile
- Copy and rename file.conf to file-env.conf,where env is the name of the environment. e.g. file-test.conf
- Copy and rename registry.conf to registry-env.conf,where env is the name of the environment. e.g. registry-test.conf
- In the registry-test.conf file, modify as follows:
registry {
...
file {
name = "file-test.conf"
}
config {
...
file {
name = "file-test.conf"
}
After all the steps have been set up, you can start using Seata configuration isolation.