-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[Feature][Config] Support persistence of configuration items modified at runtime #4704
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
19f2256 to
02e5de2
Compare
be/src/common/configbase.cpp
Outdated
| std::ofstream out(conffile); | ||
| out << "# THIS IS AN AUTO GENERATED CONFIG FILE.\n"; | ||
| out << "# You can modify this file manually, and the configurations in this file\n"; | ||
| out << "# will overwrite the configurations in fe.conf\n"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| out << "# will overwrite the configurations in fe.conf\n"; | |
| out << "# will overwrite the configurations in be.conf\n"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
| // So the number of query params should at most be 2. | ||
| if (req->params()->size() > 2 || req->params()->size() < 1) { | ||
| s = Status::InvalidArgument(""); | ||
| msg = "Now only support to set a single config once, via 'config_name=new_value'"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you should also describe the optional parameter persist in error message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
| } else if (req->params()->size() == 2) { | ||
| if (req->params()->find(PERSIST_PARAM) == req->params()->end()) { | ||
| s = Status::InvalidArgument(""); | ||
| msg = "Now only support to set a single config once, via 'config_name=new_value'"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
|
|
||
| This document mainly introduces the relevant configuration items of BE. | ||
|
|
||
| The BE configuration file `be.conf` is usually stored in the `conf/` directory of the BE deployment path. In version 0.14, another configuration file `be_custom.conf` will be introduced. The configuration file is used to record the configuration items that are dynamically configured and persisted by the user during operation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... is used for recording ... ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is translated by Google Translator... So, I think it is correct ^^
| **Configuration items modified in this way will become invalid after the BE process restarts. ** | ||
| ``` | ||
| curl -X POST http://{be_ip}:{be_http_port}/api/update_config?{key}={value}&persis=true' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| curl -X POST http://{be_ip}:{be_http_port}/api/update_config?{key}={value}&persis=true' | |
| curl -X POST http://{be_ip}:{be_http_port}/api/update_config?{key}={value}&persist=true' |
| 在 0.13 版本及之前,通过该方式修改的配置项将在 BE 进程重启后失效。在 0.14 及之后版本中,可以通过以下命令持久化修改后的配置。修改后的配置项存储在 `be_custom.conf` 文件中。 | ||
|
|
||
| ``` | ||
| curl -X POST http://{be_ip}:{be_http_port}/api/update_config?{key}={value}&persis=true' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| curl -X POST http://{be_ip}:{be_http_port}/api/update_config?{key}={value}&persis=true' | |
| curl -X POST http://{be_ip}:{be_http_port}/api/update_config?{key}={value}&persist=true' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK
| } | ||
|
|
||
| try (FileOutputStream fos = new FileOutputStream(file)) { | ||
| props.store(fos, "THIS IS AN AUTO GENERATED CONFIG FILE. DO NOT EDIT IT!\n\n" + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think users can edit this file if they need to.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK
a0393d9 to
330e656
Compare
yangzhg
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
330e656 to
4c71bf5
Compare
yangzhg
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
Proposed changes
Support persistence of configuration items modified at runtime via HTTP API.
The modified config will be saved in
fe_custom.conforbe_custom.conf.And when process starts, it will load
fe.conf/be.conffirst, thenfe_custom.conf/be_custom.conf.Types of changes
Checklist