You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2020/11/29 15:30:25 UTC

[GitHub] [apisix] spacewander commented on a change in pull request #2893: feat: allow user to specify APISIX id in config.yaml

spacewander commented on a change in pull request #2893:
URL: https://github.com/apache/apisix/pull/2893#discussion_r532225055



##########
File path: FAQ_CN.md
##########
@@ -250,3 +250,14 @@ APISIX 主要使用 [etcd.watchdir](https://github.com/api7/lua-resty-etcd/blob/
 * 如果监听目录有数据更新:etcd 将立刻返回订阅(毫秒级)到的新数据,APISIX 将它更新到内存缓存。
 
 借助 etcd 增量通知毫秒级特性,APISIX 也就完成了毫秒级的配置同步。
+
+## 如何自定义 APISIX 实例 id
+
+默认情况下,APISIX 使用 `uuid` 作为实例 id,存储在`/conf/apisix.uid`中,在 APISIX 第一次启动时生成,不会改变。

Review comment:
       The subject of this sentence is inconsistent.
   What about:
   APISIX 会从 `conf/apisix.uid` 中读取实例 id。
   如果找不到,且没有配置 id,APISIX 会生成一个 `uuid` 作为实例 id。

##########
File path: apisix/core/id.lua
##########
@@ -65,9 +66,15 @@ function _M.init()
         return
     end
 
-    uuid.seed()
-    apisix_uid = uuid.generate_v4()
-    log.notice("not found apisix uid, generate a new one: ", apisix_uid)
+    --allow user to specify a meaningful id as apisix instance id
+    local local_conf = fetch_local_conf()
+    if local_conf and local_conf.apisix and local_conf.apisix.id then

Review comment:
       Can we use try_read_attr?
   https://github.com/apache/apisix/blob/ce1d40b42f056f46b20386e1937fc81ba69e84c6/apisix/core/table.lua#L63

##########
File path: FAQ_CN.md
##########
@@ -250,3 +250,14 @@ APISIX 主要使用 [etcd.watchdir](https://github.com/api7/lua-resty-etcd/blob/
 * 如果监听目录有数据更新:etcd 将立刻返回订阅(毫秒级)到的新数据,APISIX 将它更新到内存缓存。
 
 借助 etcd 增量通知毫秒级特性,APISIX 也就完成了毫秒级的配置同步。
+
+## 如何自定义 APISIX 实例 id
+
+默认情况下,APISIX 使用 `uuid` 作为实例 id,存储在`/conf/apisix.uid`中,在 APISIX 第一次启动时生成,不会改变。
+
+如果你想指定一个有意义的 id 来绑定 APISIX 实例与你的内部系统,你可以在`conf/config.yaml`中进行配置,示例:

Review comment:
       "与" should be "到"




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org