-
Notifications
You must be signed in to change notification settings - Fork 2.8k
feat(disvocery): Add zookeeper discovery #12772
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
base: master
Are you sure you want to change the base?
feat(disvocery): Add zookeeper discovery #12772
Conversation
7bfba46 to
01f70df
Compare
Baoyuantop
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.
Hi @dongjiang1989, thanks for your contribution. Could you add documentation and testing for this feature? You can refer to other service discovery modules for reference.
Thanks @Baoyuantop |
3993d37 to
ea3c33e
Compare
f25602f to
3435db2
Compare
|
@Baoyuantop Please review docs, thanks |
|
Hi @dongjiang1989, additional tests are needed to verify that the function works correctly. |
Got it. I'll add UT soon |
|
Hi @dongjiang1989, any update? |
9ce82a8 to
836a97b
Compare
448b4c1 to
f81575e
Compare
Signed-off-by: dongjiang1989 <[email protected]>
80c05ef to
00618b0
Compare
Thanks @Baoyuantop |
| end | ||
|
|
||
| -- Scheduled fetch of all service instances (full cache update)) | ||
| local function fetch_all_services() |
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.
Do not fetch all services from ZooKeeper. This can cause significant network overhead when there are many services in ZooKeeper. It is recommended to refer to the Nacos implementation and use a timer to iterate through the currently configured Upstream, Route, and Service resources of APISIX, collecting all currently used service_names (with discovery_type set to zookeeper). Only perform ZooKeeper queries and cache updates on these "in-use" services.
| log.info("zookeeper_conf:", core.json.encode(zookeeper_conf)) | ||
| -- Start the timer | ||
| if not fetch_timer then | ||
| fetch_timer = ngx.timer.every(zookeeper_conf.fetch_interval, fetch_all_services) |
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.
It is recommended that only privileged processes request data from ZooKeeper and write it to the shared dict, while other processes read the data from the shared dict.
Signed-off-by: jiangdong <[email protected]>
|
Hi @dongjiang1989, following up on the previous review comments. Please let us know if you have any updates. Thank you. |
Description
Which issue(s) this PR fixes:
Fixes #3231 #6687
Add zookeeper discovery
Checklist