# Need Help on how it works

**URL:** <https://forum.yugabyte.com/t/need-help-on-how-it-works/4401>\
**Category:** General\
**Created:** [April 25, 2025, 7:18pm UTC](https://forum.yugabyte.com/t/need-help-on-how-it-works/4401 "2025-04-25T19:18:05Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![bkfdev](https://avatars.discourse-cdn.com/v4/letter/b/7ab992/32.png) [@bkfdev](https://forum.yugabyte.com/u/bkfdev)\
**Post date:** [April 25, 2025, 7:18pm UTC](https://forum.yugabyte.com/t/need-help-on-how-it-works/4401/1 "2025-04-25T19:18:05Z")

</div>

Hello everyone,  
I have few questions since I’m newbie here 🙂

1. Is there a ready docker-compose file for a basic usage (as I know : 3 nodes type zone, 1 master with 2 joins, and read replicas ) to integrate with nodejs app
2. Can we use it on production using just docker without any problem ?
3. Let’s say we have 3 nodes, as I understand, when a client requests an api get / post, yugabyte will choose the best node for response same as load-balancers do ?  
Thank you 🙂

---

<div class="post-metadata">

**Author:** ![nmalladi](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.yugabyte.com/nmalladi/32/236_2.png) [@nmalladi](https://forum.yugabyte.com/u/nmalladi)\
**Post date:** [April 25, 2025, 7:56pm UTC](https://forum.yugabyte.com/t/need-help-on-how-it-works/4401/2 "2025-04-25T19:56:26Z")

</div>

Hi @bkfdev

We are glad you’ve started your YugabyteDB journey. I can help you answer the questions -

1. Here are the docs link for getting started with docker -

- [YugabyteDB Quick start for Docker | YugabyteDB Docs](https://docs.yugabyte.com/preview/tutorials/quick-start/docker/)

- [yugabyted reference | YugabyteDB Docs](https://docs.yugabyte.com/preview/reference/configuration/yugabyted/#create-a-multi-region-cluster-in-docker)

- Getting started with implementing nodejs apps with YugabyteDB - [Node.js drivers and ORMs | YugabyteDB Docs](https://docs.yugabyte.com/preview/drivers-orms/nodejs/)

1. We generally don’t recommend running Docker-based deployments in production. There are a few users in the community who are doing so. We recommend deploying YugabyteDB on Kubernetes to run production container workloads. [Open source Kubernetes using YugabyteDB operator | YugabyteDB Docs](https://docs.yugabyte.com/preview/deploy/kubernetes/single-zone/oss/yugabyte-operator/)

2. 

> [@bkfdev](#):
>
> 1. Let’s say we have 3 nodes, as I understand, when a client requests an api get / post, yugabyte will choose the best node for response same as load-balancers do ?  
> Thank you 🙂

Yes, in the simplest of explanations, your understanding is correct. YugabyteDB distributes(shards) the data in all the available nodes of the universe, so the app doesn’t need to know where the data is located and can send the query ( SELECT/INSERTs) to any node and apps will get the required data.

You can further explore the YugabyteDB data distribution here - [Data distribution | YugabyteDB Docs](https://docs.yugabyte.com/preview/explore/linear-scalability/data-distribution/#cluster-setup)

Let us know if you have any questions. Thanks

---

<div class="post-metadata">

**Author:** ![bkfdev](https://avatars.discourse-cdn.com/v4/letter/b/7ab992/32.png) [@bkfdev](https://forum.yugabyte.com/u/bkfdev)\
**Post date:** [April 25, 2025, 8:36pm UTC](https://forum.yugabyte.com/t/need-help-on-how-it-works/4401/3 "2025-04-25T20:36:27Z")

</div>

Thank you for quick reply,  
Actually I’m using this setup below, everything is created, and I can access to 7000, 15433, and I’m able to use ysqlsh and create roles, databases ..etc, but nothing is shown on 15433 =\> [http://localhost:15433/databases/tabYsql](http://localhost:15433/databases/tabYsql)  
Docker-compose :

```auto
db-1:
   image: yugabytedb/yugabyte:latest
   container_name: otlob-db-1
   command:
     [
       "bin/yugabyted",
       "start",
       "--listen=db-1",
       "--background=false",
       "--cloud_location=otlob.zone.a",
       "--fault_tolerance=zone",
       "--base_dir=/home/yugabyte/yb_data",
     ]
   ports:
     - "5433:5433"
     - "15433:15433"
     - "7000:7000"
     - "9000:9000"
   volumes:
     - ./data/db-1:/home/yugabyte/yb_data
   networks:
     - otlob-network

   healthcheck:
     test: ["CMD-SHELL", "yugabyted status && exit 0 || exit 1"]
     interval: 10s
     timeout: 5s
     retries: 5
     start_period: 20s

 db-2:
   image: yugabytedb/yugabyte:latest
   container_name: otlob-db-2
   command:
     [
       "bin/yugabyted",
       "start",
       "--listen=db-2",
       "--join=db-1",
       "--background=false",
       "--cloud_location=otlob.zone.b",
       "--fault_tolerance=zone",
       "--base_dir=/home/yugabyte/yb_data",
     ]
   ports:
     - "5434:5433"
     - "15434:15433"
   volumes:
     - ./data/db-2:/home/yugabyte/yb_data

   depends_on:
     db-1:
       condition: service_healthy
   networks:
     - otlob-network

 db-3:
   image: yugabytedb/yugabyte:latest
   container_name: otlob-db-3
   command:
     [
       "bin/yugabyted",
       "start",
       "--listen=db-3",
       "--join=db-1",
       "--background=false",
       "--cloud_location=otlob.zone.c",
       "--fault_tolerance=zone",
       "--base_dir=/home/yugabyte/yb_data",
     ]
   ports:
     - "5435:5433"
     - "15435:15433"
   volumes:
     - ./data/db-3:/home/yugabyte/yb_data
   networks:
     - otlob-network
   depends_on:
     db-1:
       condition: service_healthy
#Docker Networks
networks:
 otlob-network:
   driver: bridge

```

And when I try create database from nodejs, I get this error :  
`error: SELECT PG_ADVISORY_UNLOCK('1') as lock_status; - advisory locks feature is currently in preview`

---

<div class="post-metadata">

**Author:** ![nmalladi](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.yugabyte.com/nmalladi/32/236_2.png) [@nmalladi](https://forum.yugabyte.com/u/nmalladi)\
**Post date:** [April 25, 2025, 10:05pm UTC](https://forum.yugabyte.com/t/need-help-on-how-it-works/4401/4 "2025-04-25T22:05:31Z")

</div>

Are you using Prisma or Sequelize for connecting to YB? Can you pls send us the complete app log?

---

<div class="post-metadata">

**Author:** ![bkfdev](https://avatars.discourse-cdn.com/v4/letter/b/7ab992/32.png) [@bkfdev](https://forum.yugabyte.com/u/bkfdev)\
**Post date:** [April 26, 2025, 5:47am UTC](https://forum.yugabyte.com/t/need-help-on-how-it-works/4401/5 "2025-04-26T05:47:10Z")

</div>

I’ve just tested the code mentioned here : [nodejs with yugabytedb](https://docs.yugabyte.com/preview/drivers-orms/nodejs/yugabyte-pg-reference/)

Here’s the console log :

```auto
/home/bkf/Work/Otlob/node_modules/@yugabytedb/pg/lib/client.js:230
      throw new Error('Could not find a least loaded server.')
            ^

Error: Could not find a least loaded server.
    at Client.getLeastLoadedServer (/home/bkf/Work/Otlob/node_modules/@yugabytedb/pg/lib/client.js:230:13)
    at Client._connect (/home/bkf/Work/Otlob/node_modules/@yugabytedb/pg/lib/client.js:355:26)
    at /home/bkf/Work/Otlob/node_modules/@yugabytedb/pg/lib/client.js:711:12
    at new Promise (<anonymous>)
    at Client.nowConnect (/home/bkf/Work/Otlob/node_modules/@yugabytedb/pg/lib/client.js:710:12)
    at /home/bkf/Work/Otlob/node_modules/@yugabytedb/pg/lib/client.js:855:26
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)

```

And in my node app developed by AdonisJs,  
I got this :

```auto
error: SELECT PG_ADVISORY_UNLOCK('1') as lock_status; - advisory locks feature is currently in preview
 

   ⁃ Parser.parseErrorMessage
     node_modules/pg-protocol/dist/parser.js:285
   ⁃ Parser.handlePacket
     node_modules/pg-protocol/dist/parser.js:122
   ⁃ Parser.parse
     node_modules/pg-protocol/dist/parser.js:35

```

---

<div class="post-metadata">

**Author:** ![dorian\_yugabyte](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.yugabyte.com/dorian_yugabyte/32/206_2.png) [@dorian\_yugabyte](https://forum.yugabyte.com/u/dorian_yugabyte)\
**Post date:** [April 28, 2025, 8:57am UTC](https://forum.yugabyte.com/t/need-help-on-how-it-works/4401/6 "2025-04-28T08:57:48Z")

</div>

> [@bkfdev](#):
>
> ` image: yugabytedb/yugabyte:latest`

Please use an explicit version so we know what’s being used.

> [@bkfdev](#):
>
> ` "--join=db-1",`

Please try with a single node first if it works (ui etc). Then the local cluster.

> [@bkfdev](#):
>
> `error: SELECT PG_ADVISORY_UNLOCK('1') as lock_status; - advisory locks feature is currently in preview`

Please see [Explicit locking | YugabyteDB Docs](https://docs.yugabyte.com/preview/explore/transactions/explicit-locking/#advisory-locks) :

> To enable the use of advisory locks in a cluster, you must set the [Advisory lock flags](https://docs.yugabyte.com/preview/reference/configuration/yb-tserver/#advisory-lock-flags).

I don’t see the flags in the configuration you posted.

> [@bkfdev](#):
>
> And when I try create database from nodejs, I get this error :

Please describe the exact queries being done. Generally, creating a database means simply `create database ....`, which has no relation to Advisory Locks. So you’re most probably doing something else than `create database ...` statement.

> [@bkfdev](#):
>
> Here’s the console log :

Please try things step by step so we know what broke and when. You might have multiple broken things here.

---

<div class="post-metadata">

**Author:** ![bkfdev](https://avatars.discourse-cdn.com/v4/letter/b/7ab992/32.png) [@bkfdev](https://forum.yugabyte.com/u/bkfdev)\
**Post date:** [April 30, 2025, 7:25pm UTC](https://forum.yugabyte.com/t/need-help-on-how-it-works/4401/7 "2025-04-30T19:25:34Z")

</div>

Thank you for your assistance  
In fact I’ve resolved all issues after deep search/practice 🙂
