wklken commented on issue #9951:
URL: https://github.com/apache/apisix/issues/9951#issuecomment-1663874249

   @Sn0rt  I have reproduce it via docker-compose;  the key is change the 
`deployment.etcd.prefix`!
   
   ------
   
   the steps:
   1. `git clone https://github.com/apache/apisix-docker.git`
   2. `cd apisix-docker/compose`
   3. edit the docker-compose-master.yaml
   ```yaml
   version: "3"
   
   services:
     apisix:
       # image: "apache/apisix:${APISIX_DOCKER_TAG}"
       image: "apache/apisix:3.2.2-centos"
       restart: always
       volumes:
         - 
./apisix_conf/master/config.yaml:/usr/local/apisix/conf/config.yaml:ro
       depends_on:
         - etcd
       ports:
         - "9180:9180/tcp"
         - "9080:9080/tcp"
         - "9091:9091/tcp"
         - "9443:9443/tcp"
       networks:
         - apisix
   
     etcd:
       image: bitnami/etcd:3.5.7
       # user: root
       # restart: always
       volumes:
         - ../example/etcd_data:/bitnami/etcd_data
           # volumes:
           #   - etcd_data:/bitnami/etcd
       environment:
         ETCD_DATA_DIR: /etcd_data
         ETCD_ENABLE_V2: "true"
         ALLOW_NONE_AUTHENTICATION: "yes"
         ETCD_ADVERTISE_CLIENT_URLS: "http://0.0.0.0:2379";
         ETCD_LISTEN_CLIENT_URLS: "http://0.0.0.0:2379";
       ports:
         - "2379:2379/tcp"
       networks:
         - apisix
   
   networks:
     apisix:
       driver: bridge
   ```
   4. edit the `apisix_conf/master/config.yaml`
   ```
   apisix:
     node_listen: 9080              # APISIX listening port
     enable_ipv6: false
   
     router:
       http: radixtree_uri_with_parameter
   
   nginx_config:
     http:
       enable_access_log: false
       client_max_body_size: "40m"
   
     error_log_level: "info"
     worker_processes: 1
   
   deployment:
     admin:
       allow_admin:               # 
https://nginx.org/en/docs/http/ngx_http_access_module.html#allow
         - 0.0.0.0/0              # We need to restrict ip access rules for 
security. 0.0.0.0/0 is for test.
   
       admin_key:
         - name: "admin"
           key: edd1c9f034335f136f87ad84b625c8f1
           role: admin                 # admin: manage all configuration data
   
     etcd:
       host:                           # it's possible to define multiple etcd 
hosts addresses of the same etcd cluster.
         - "http://etcd:2379";          # multiple etcd address
       prefix: "/test-apisix"               # apisix configurations prefix
       timeout: 120                    # 30 seconds
   ```
   6. `rm -rf ../example/etcd_data/*` 
   7. `docker-compose -p docker-apisix -f docker-compose-master.yaml up`
   8. open another terminal, `docker ps -a` get the running container id of 
apisix
   9. `docker exec -it {the id} /bin/bash`
   10. register the route and service
   ```
   curl http://127.0.0.1:9180/apisix/admin/services/200 \
                                                                   -H 
'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
                                                   {
                                                       "upstream": {
                                                           "type": "roundrobin",
                                                           "nodes": {
                                                         "etcd:2379": 1
                                                           }
                                                       }
                                                   }'
   curl http://127.0.0.1:9180/apisix/admin/routes/100 \
                                                   -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
                                       {
                                           "methods": ["GET"],
                                           "uri": "/metrics",
                                           "service_id": "200"
                                       }'
   ```
   11. there got no watch logs for the route and resource (if you change the 
`prefix` back, you can see the logs)
   12. curl, got 404 `curl http://localhost:9080/metrics -v`
   
   
   -----
   
   if we change the `prefix` back to `/apisix`, the step 12 will got 200
   
   
   
   
   


-- 
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.

To unsubscribe, e-mail: notifications-unsubscr...@apisix.apache.org

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

Reply via email to