Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Some flags in alloy db don't seem to be working.

Hi there,

I created an alloy DB cluster and tried to change its settings using flag. I tried to set flags below:

  • tcp_keepalives_count = 5
  • max_connections = 1500

After that, I ran a SQL query to confirm that above flags are working. The queries and results are below:

 

 

 

 

postgres=> SELECT name, setting FROM pg_settings where name = 'tcp_keepalives_count';
         name         | setting 
----------------------+---------
 tcp_keepalives_count | 0
(1 row)

postgres=> SELECT name, setting FROM pg_settings where name = 'max_connections';
      name       | setting 
-----------------+---------
 max_connections | 1500
(1 row)

postgres=> 

 

 

 

 

As you can see, max_connections flag works well but tcp_keepalives_count flag does not work.

According to this document , tcp_keepalives_count flag is available and does not require a reboot.

Just in case, I rebooted a primary instance but this flag remained inoperative. How can I make this flag working?

Solved Solved
0 4 1,034
1 ACCEPTED SOLUTION

Hi @kumards ,

Thank you for your reply, and sorry for late reply again.

It seems that your advice is really great, but I regret to inform you that our project using AlloyDB has been closed. So all resources that contain an AlloyDB cluster have been deleted, and I cannot try your advice. Sorry for that.

I really appreciate your and @christianpaula 's help.

View solution in original post

4 REPLIES 4

Hi @yusaito,

Welcome to Google Cloud Community!

You can set the tcp_keepalives_count flag in the postgresql.conf configuration file. This file is typically located in the data directory of your PostgreSQL installation.
 
To set the tcp_keepalives_count flag, you will need to add the following line to the postgresql.conf file:
 
tcp_keepalives_count = 5
 
You will need to restart the PostgreSQL service for the changes to take effect. You can do this by running the following command:
 
sudo service postgresql restart
 
If you are running PostgreSQL in a container, you will need to update the configuration file in the container and then restart the container for the changes to take effect.
 
Once you have made the changes and restarted the service, you can verify that the tcp_keepalives_count flag is set correctly by running the following SQL query:
 
SELECT name, setting FROM pg_settings WHERE name = 'tcp_keepalives_count';

Thank you

Hi @christianpaula 

Thank you for your reply and I'm sorry for my late reply.

I understood your point, but can I access alloy DB instances using SSH?
In my understanding, alloy DB is a fully managed DB service so I think I cannot access its instances using SSH.

Thank you.

 

 

Hi @yusaito ,

Just to be sure, did you follow the steps in the following document to configure the flags?

https://cloud.google.com/alloydb/docs/instance-configure-database-flags 

After you set a flag, you'll see a message like the following in the operations pop-up near the lower-right corner of the console:

kumards_0-1673462803006.png

After the database is update, you'll see a message like:

kumards_1-1673462852293.png

And the console will show the flag:

kumards_2-1673462881421.png

And you should be able to see the same value when you query the flag via psql:

postgres=> SELECT name, setting FROM pg_settings where name = 'tcp_keepalives_count';
name | setting
----------------------+---------
tcp_keepalives_count | 5
(1 row)

Hi @kumards ,

Thank you for your reply, and sorry for late reply again.

It seems that your advice is really great, but I regret to inform you that our project using AlloyDB has been closed. So all resources that contain an AlloyDB cluster have been deleted, and I cannot try your advice. Sorry for that.

I really appreciate your and @christianpaula 's help.