吾爱破解 - 52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 1329|回复: 2
收起左侧

[求助] nacos 2.1.1怎么删除永久实例(非临时实例)以及对应的fu'w

[复制链接]
yx548634898 发表于 2022-8-31 10:18

nacos 2.1.1怎么删除永久实例(非临时实例)。nacos 2.1.1中设置了个永久实例(ephemeral: false)。然后发现这个服务一直挂在nacos上,删除不了了。像这种(https://zhuanlan.zhihu.com/p/468432927)通过OpenApi先删除实例,然后删除服务的。delete了也没用,在页面上还是能看到

        String url = "http://127.0.0.1:8848/nacos/v1/ns/instance?serviceName=" + serviceName +"&ip=" + ip +"&port=" + port;
        System.out.println("=========注销实例=========URL: " + url);
//        restTemplate.delete(url);
        try {
            HttpClient httpClient = HttpClientBuilder.create().build();
            HttpResponse response = httpClient.execute(new HttpDelete(url));
        } catch (Exception e) {
            e.printStackTrace();
        }
        String url = "http://127.0.0.1:8848/nacos/v1/ns/service?serviceName=" + serviceName;
        System.out.println("=========删除服务=========URL: " + url);
//        restTemplate.delete(url);
        try {
            HttpClient httpClient = HttpClientBuilder.create().build();
            HttpResponse response = httpClient.execute(new HttpDelete(url));
        } catch (Exception e) {
            e.printStackTrace();
        }

请问哪位大佬知道怎么处理吗?或者说我那做的不对?求指导!!!

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

 楼主| yx548634898 发表于 2022-8-31 10:46

删除实例都提示DEBUG org.apache.http.wire - http-outgoing-0 << "ok"了。

10:42:05.907 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "DELETE /nacos/v1/ns/instance?serviceName=orderservice&ip=192.168.188.1&port=8080 HTTP/1.1[\r][\n]"
10:42:05.907 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "Host: 127.0.0.1:8848[\r][\n]"
10:42:05.907 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "Connection: Keep-Alive[\r][\n]"
10:42:05.907 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "User-Agent: Apache-HttpClient/4.5.13 (Java/1.8.0_341)[\r][\n]"
10:42:05.907 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "Accept-Encoding: gzip,deflate[\r][\n]"
10:42:05.907 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "[\r][\n]"
10:42:05.910 [main] DEBUG org.apache.http.wire - http-outgoing-0 << "HTTP/1.1 200 [\r][\n]"
10:42:05.910 [main] DEBUG org.apache.http.wire - http-outgoing-0 << "Vary: Origin[\r][\n]"
10:42:05.910 [main] DEBUG org.apache.http.wire - http-outgoing-0 << "Vary: Access-Control-Request-Method[\r][\n]"
10:42:05.910 [main] DEBUG org.apache.http.wire - http-outgoing-0 << "Vary: Access-Control-Request-Headers[\r][\n]"
10:42:05.910 [main] DEBUG org.apache.http.wire - http-outgoing-0 << "Content-Security-Policy: script-src 'self'[\r][\n]"
10:42:05.910 [main] DEBUG org.apache.http.wire - http-outgoing-0 << "Content-Type: text/plain;charset=UTF-8[\r][\n]"
10:42:05.910 [main] DEBUG org.apache.http.wire - http-outgoing-0 << "Content-Length: 2[\r][\n]"
10:42:05.910 [main] DEBUG org.apache.http.wire - http-outgoing-0 << "Date: Wed, 31 Aug 2022 02:42:05 GMT[\r][\n]"
10:42:05.910 [main] DEBUG org.apache.http.wire - http-outgoing-0 << "Keep-Alive: timeout=60[\r][\n]"
10:42:05.910 [main] DEBUG org.apache.http.wire - http-outgoing-0 << "Connection: keep-alive[\r][\n]"
10:42:05.910 [main] DEBUG org.apache.http.wire - http-outgoing-0 << "[\r][\n]"
10:42:05.910 [main] DEBUG org.apache.http.wire - http-outgoing-0 << "ok"
10:42:05.912 [main] DEBUG org.apache.http.headers - http-outgoing-0 << HTTP/1.1 200 

删除服务却会提示500报错

10:45:12.645 [main] DEBUG org.apache.http.headers - http-outgoing-0 >> DELETE /nacos/v1/ns/service?serviceName=orderservice HTTP/1.1
10:45:12.645 [main] DEBUG org.apache.http.headers - http-outgoing-0 >> Host: 127.0.0.1:8848
10:45:12.645 [main] DEBUG org.apache.http.headers - http-outgoing-0 >> Connection: Keep-Alive
10:45:12.645 [main] DEBUG org.apache.http.headers - http-outgoing-0 >> User-Agent: Apache-HttpClient/4.5.13 (Java/1.8.0_341)
10:45:12.645 [main] DEBUG org.apache.http.headers - http-outgoing-0 >> Accept-Encoding: gzip,deflate
10:45:12.645 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "DELETE /nacos/v1/ns/service?serviceName=orderservice HTTP/1.1[\r][\n]"
10:45:12.645 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "Host: 127.0.0.1:8848[\r][\n]"
10:45:12.645 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "Connection: Keep-Alive[\r][\n]"
10:45:12.646 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "User-Agent: Apache-HttpClient/4.5.13 (Java/1.8.0_341)[\r][\n]"
10:45:12.646 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "Accept-Encoding: gzip,deflate[\r][\n]"
10:45:12.646 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "[\r][\n]"
10:45:12.648 [main] DEBUG org.apache.http.wire - http-outgoing-0 << "HTTP/1.1 500 [\r][\n]"
lu_wakin 发表于 2022-8-31 14:31
直接数据库里删不就行了,要么sqlite,要么mysql里,看你nacos用的哪个本地存储
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

返回列表

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-11-25 07:35

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表