Change admin port : indexer_admin_port/9100

Hello,

I would like to change the admin port 9100 to 19100 but I was not able to do it.

So I am running 2 couchbase servers community 7 using docker (clustering) and I mounted a volume to change the static_config by adding {indexer_admin_port, 9100}. but after killing/removing the container. The servers are still listening on port 9100 and in the indexer logs, I can see servers are still trying to connect on 9100…

So any idea on how to change the 9100 port to 19100?

Thanks

Note : I followed this documentation Couchbase Server Ports | Couchbase Docs… But It seems like it doesnt work…

So I am running 2 couchbase servers community 7 using docker

I’m not sure I understand your environment - are the servers each in their own docker container? If so, the ports inside the containers need to be mapped to external ports. The couchbase ports inside the containers don’t need to be changed - just mapped to (different) external ports.

Thanks for replying.

I mean I am running 2 servers and each server has its own docker running a couchbase container.

So I need to expose the port 9100 to 9105 (with -p) on each server running the couchbase server cuz they are in a cluster

But I would like to change 9100 port to 19100 ( I know I can expose with -p 19100:9100) because I have already an app that uses the same port… But how can I tell to couchbase to use 19100 instead of 9100 for indexer_admin_port?

You can use a different hostname with --hostname and use port 9100 for both… I think that will avoid the conflict.

See - https://support.circleci.com/hc/en-us/articles/360007186173-Port-conflicts-with-service-containers-on-Docker-executor

I am confused… It won’t work accross multiple servers ? It will only work if the containers run on the same server?

My couchbase configuration looks like this

Server1 ---|
           | Clustering
Server2 ---|

So each server is running a couchbase server and also other applications. But both applications are using the same port : 9100.

So I need to override the port 9100 on the couchbase container to make both applications without port conflict :confused:

If the ports are on different hosts (specified by --hostname), they won’t conflict.

So I gave a try with --hostname in my docker-compose and I am still getting:

"2023-04-26T20:24:56.426+00:00 [Error] EmbeddedServer.boostrap: error : Server Error : Fail to start PeerListener. err = %v : listen tcp4 :9100: bind: address already in use"

when I try to connect the two server in a in cluster.

I just gave a try on https://labs.play-with-docker.com/, add 2 nodes and ran a random conf (below) to simulate a port conflit on 9100

Node1 (or Server1) :
docker run -d -p 9100:9100 --name prom prom/node-exporter
and create a docker-compose.yml file with:

services:
  couchbase:
    image: couchbase:community
    hostname: cb1
    volumes:
      - /var/lib/couchbase:/opt/couchbase/var
    network_mode: "host"

then docker-compose up -d

Check if the port 9100 is correctly used by node_exporter and not couchbase

netstat -altpn | grep 9100
tcp        0      0 0.0.0.0:9100            0.0.0.0:*               LISTEN      14675/docker-proxy

2nd node:
same thing but with hostname: cb2

Then I went to the admin interface to create/join a cluster but I am getting a port conflict on 9100

Did I do something wrong :confused: ?

If I kill the prom/node exporter container: I have no more problems, both servers can be in cluster

ty for the help

docker run -d -p 9100:9100 --name prom prom/node-exporter

Can node exporter use a port that couchbase doesn’t use?

node exporter was just an example but I don’t want to change the port 9100 in my house app :confused:

In your scenario with setting the hostnames of cb1 and cb2 in the yaml files - if you also set the port to something other than 9100 - such as 39100 - in the static config file, and then mapped with -p 39100:39100, then there would not be a comflict with the index exporter.

I tried to modify the static_config file in the docker by adding

{indexer_admin_port, 9100}.

But it doesn’t read it at all :confused: but I will retry it with hostname + change static_config + -p 39100:39100

thanks

From your first post - you set it to the default (unless that was a typo).

Also - I’m not sure why leaving it to 9100 (inside the container) and them mapping it to something different outside the container ( -p 9100:39100 ) wouldn’t work. With the different hostnames, of course.

Oops that was a bad c/c, of course I changed it to 19100
I just tested it with {indexer_admin_port, 19100} but it doesn’t work at all :confused: in the container when I am running netstat -altpn, it still using the 9100 port :confused:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.