nacos 2.1.1怎么删除永久实例(非临时实例)以及对应的fu'w
nacos 2.1.1怎么删除永久实例(非临时实例)。nacos 2.1.1中设置了个永久实例(ephemeral: false)。然后发现这个服务一直挂在nacos上,删除不了了。像这种(https://zhuanlan.zhihu.com/p/468432927)通过OpenApi先删除实例,然后删除服务的。delete了也没用,在页面上还是能看到。
```java
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();
}
```
```java
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();
}
```
请问哪位大佬知道怎么处理吗?或者说我那做的不对?求指导!!!
删除实例都提示DEBUG org.apache.http.wire - http-outgoing-0 << "ok"了。
```
10:42:05.907 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 DEBUG org.apache.http.wire - http-outgoing-0 >> "Host: 127.0.0.1:8848[\r][\n]"
10:42:05.907 DEBUG org.apache.http.wire - http-outgoing-0 >> "Connection: Keep-Alive[\r][\n]"
10:42:05.907 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 DEBUG org.apache.http.wire - http-outgoing-0 >> "Accept-Encoding: gzip,deflate[\r][\n]"
10:42:05.907 DEBUG org.apache.http.wire - http-outgoing-0 >> "[\r][\n]"
10:42:05.910 DEBUG org.apache.http.wire - http-outgoing-0 << "HTTP/1.1 200 [\r][\n]"
10:42:05.910 DEBUG org.apache.http.wire - http-outgoing-0 << "Vary: Origin[\r][\n]"
10:42:05.910 DEBUG org.apache.http.wire - http-outgoing-0 << "Vary: Access-Control-Request-Method[\r][\n]"
10:42:05.910 DEBUG org.apache.http.wire - http-outgoing-0 << "Vary: Access-Control-Request-Headers[\r][\n]"
10:42:05.910 DEBUG org.apache.http.wire - http-outgoing-0 << "Content-Security-Policy: script-src 'self'[\r][\n]"
10:42:05.910 DEBUG org.apache.http.wire - http-outgoing-0 << "Content-Type: text/plain;charset=UTF-8[\r][\n]"
10:42:05.910 DEBUG org.apache.http.wire - http-outgoing-0 << "Content-Length: 2[\r][\n]"
10:42:05.910 DEBUG org.apache.http.wire - http-outgoing-0 << "Date: Wed, 31 Aug 2022 02:42:05 GMT[\r][\n]"
10:42:05.910 DEBUG org.apache.http.wire - http-outgoing-0 << "Keep-Alive: timeout=60[\r][\n]"
10:42:05.910 DEBUG org.apache.http.wire - http-outgoing-0 << "Connection: keep-alive[\r][\n]"
10:42:05.910 DEBUG org.apache.http.wire - http-outgoing-0 << "[\r][\n]"
10:42:05.910 DEBUG org.apache.http.wire - http-outgoing-0 << "ok"
10:42:05.912 DEBUG org.apache.http.headers - http-outgoing-0 << HTTP/1.1 200
```
删除服务却会提示500报错
```
10:45:12.645 DEBUG org.apache.http.headers - http-outgoing-0 >> DELETE /nacos/v1/ns/service?serviceName=orderservice HTTP/1.1
10:45:12.645 DEBUG org.apache.http.headers - http-outgoing-0 >> Host: 127.0.0.1:8848
10:45:12.645 DEBUG org.apache.http.headers - http-outgoing-0 >> Connection: Keep-Alive
10:45:12.645 DEBUG org.apache.http.headers - http-outgoing-0 >> User-Agent: Apache-HttpClient/4.5.13 (Java/1.8.0_341)
10:45:12.645 DEBUG org.apache.http.headers - http-outgoing-0 >> Accept-Encoding: gzip,deflate
10:45:12.645 DEBUG org.apache.http.wire - http-outgoing-0 >> "DELETE /nacos/v1/ns/service?serviceName=orderservice HTTP/1.1[\r][\n]"
10:45:12.645 DEBUG org.apache.http.wire - http-outgoing-0 >> "Host: 127.0.0.1:8848[\r][\n]"
10:45:12.645 DEBUG org.apache.http.wire - http-outgoing-0 >> "Connection: Keep-Alive[\r][\n]"
10:45:12.646 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 DEBUG org.apache.http.wire - http-outgoing-0 >> "Accept-Encoding: gzip,deflate[\r][\n]"
10:45:12.646 DEBUG org.apache.http.wire - http-outgoing-0 >> "[\r][\n]"
10:45:12.648 DEBUG org.apache.http.wire - http-outgoing-0 << "HTTP/1.1 500 [\r][\n]"
``` 直接数据库里删不就行了,要么sqlite,要么mysql里,看你nacos用的哪个本地存储
页:
[1]