Couchdb: Removing nodes from cluster

Hi

I recently noticed that some of the nodes, which recently are not active are part of the cluster.

I run the following command:
curl -XGET -u username:password 172.19.3.41:25984/_membership

Output:

{ "all_nodes":["couchdb@172.19.3.40","couchdb@172.19.3.41","couchdb@172.19.4.36","couchdb@172.19.4.41"],
"cluster_nodes":["couchdb@172.19.3.40","couchdb@172.19.3.41","couchdb@172.19.4.36","couchdb@172.19.4.38","couchdb@172.19.4.39","couchdb@172.19.4.41"]}

The following nodes don't have any CouchDB data and already decommissioned.
"couchdb@172.19.4.38", "couchdb@172.19.4.39"

The question is: How can I remove those nodes?

@demis08 please follow the below steps

Find the revision id for decomissioned nodes:

curl "http://:15986/_nodes/couchdb@172.19.4.38" -u -p
curl "http://:15986/_nodes/couchdb@172.19.4.39" -u -p

Delete the unused nodes from the cluster

curl -X DELETE "http://:15986/_nodes/couchdb@172.19.4.38?rev=1-967a00dff5e02add41819138abb3284d" -u -p
curl -X DELETE "http://:15986/_nodes/couchdb@172.19.4.39?rev=1-967a00dff5e02add41819138abb3284d" -u -p