PostgreSQL default cluster? - postgresql

I am running PostgreSQL 9.3 on Ubuntu 14.04 LTS. I didn't remember creating a cluster but directly went to create database.
Using pg_lsclusters, I found that I have a cluster as following with my db
Ver Cluster Port Status Owner Data directory
9.3 main 5432 online postgres /var/lib/postgresql/9.3/main
I was reading the PostgreSQL documentation but couldn't find relevant info.
I have the following questions:
Does PostgreSQL automatically create default cluster? And if so, is it good practice to use it?
Does PostgreSQL also automatically start the default cluster? I never started but its status is online and I can see it in system-monitor.
Thanks for any clarifications!

You're really asking about "PostgreSQL on Debian or Ubuntu", as it's the packaging and wrapper utilities doing this, not PostgreSQL its self.
See the PostgreSQL help on the Ubuntu community wiki for information. This mostly applies to Debian too, since it uses the same style of packaging for PostgreSQL.
To your specific questions:
Does PostgreSQL automatically create default cluster? And if so, is it good practice to use it?
Strictly pg_wrapper, the Ubuntu/Debian tool that manages PostgreSQL installs, creates it. Yes, it's fine to use it and there's generally not much reason not to.
Does PostgreSQL also automatically start the default cluster?
This depends on your operating system and its PostgreSQL packages, not on PostgreSQL its self. For information on how to configure what starts on Ubuntu, see Boot Howto - Ubuntu Community Wiki.

Related

Azure Postgres Single server version upgrade

Azure Postgres Single server version is 11. Is it possible to upgrade it to 13+ version using dump and restore as mentioned here:
https://learn.microsoft.com/en-us/azure/postgresql/how-to-upgrade-using-dump-and-restore
It should still remain Single Server.
Yes, you can.
The document you shared is Microsoft's official and therefore there is no doubt that you can upgrade it to any higher version using dump and restore.
Just take care of the below mentioned points:
You can upgrade your PostgreSQL server deployed in Azure Database for PostgreSQL by migrating your databases to a higher major version server using following methods.
Offline method using PostgreSQL pg_dump and pg_restore which incurs downtime for migrating the data.
Online method using Database Migration Service (DMS). This method provides a reduced downtime migration and keeps the target database in-sync with the source and you can choose when to cut-over. However, there are few prerequisites and restrictions to be addressed for using DMS.
The following table provides some recommendations based on database sizes and scenarios.
Choose the right approach based on your database configuration and it should be done without any issue.
To upgrade using pg_dump and pg_restore, you can refer Migrate your PostgreSQL database by using dump and restore.
It is not possible.
In the document, prerequisites states:
A source PostgreSQL database server running a lower version of the
engine that you want to upgrade. A target PostgreSQL database server
with the desired major version Azure Database for PostgreSQL server -
Single Server or Azure Database for PostgreSQL - Flexible Server.
The question asks about upgrading target.

AWS RDS PostgreSQL Upgrade from 9.6.22 to 10.17

Good day. I just finished upgrading my AWS RDS database engine from 9.6.22 to 10.17. I used these steps to make the upgrade using the AWS Console:
Create snapshot of target database to upgrade
Restore snapshot
Upgrade the restored snapshot's (which is now a new instance) DB Engine version.
After I did all of this, everything seems fine but when I access the database, this warning message appears
WARNING: psql major version 9.6, server major version 10.
Some psql features might not work.
I did not continue on my testing because I want to know what is the meaning of this first. Because I am fairly new in AWS as a whole. Thanks!
The meaning is that just because you are connecting to an upgraded database on some machine run by Amazon, the PostgreSQL installation on your local machine was not magically updated. psql from version 9.6 doesn't know what metadata tables were changed in v10, what features were removed and so on.
It would be a good idea to install a more recent version of PostgreSQL on your machine. By the way, upgrading to v10 was not the smartest move, as that version will go out of support in less than a year. You should upgrade to the latest version that your service provider offers.
The client program psql you are using to connect to the database is from an older version than the database it is connecting to. Some of the introspection features might not work. For example, psql from 9.6 won't know how to do tab completion for commands that were added to the server after 9.6.
This is generally not a major problem for psql (unless the server wants to use SCRAM authentication), but for optimal experience it would be good to install a newer client. Other tools like pg_dimp might not with at all against a server newer than they are.

how to create postgresql server on rhel7 linux vm in gcp

I am actually planning to have a PostgreSQL instance on rhel7 linux vm running on google cloud platform,
Can you let me know the process for the same.
One more query is it ok to install postgresql on vm rather than going for a cloud sql instance on gcp?
Thanks,
Moin.
Just go to the PostgresSQL official downloads page for redhat and install the software.
You can get the RPMs there if you need to do an air-gapped installation.
You'll need to configure postgres later. See Posgres docs Chapter 18. Server Setup and Operation.

What is the difference between pgAdmin and Postgres.app?

After reading official websites as well as conducting Google research I still do not clearly understand how pgAdmin and Postgres.app relate to one another?
For example, I can simultaneously run two different local postgres servers on different ports from both pgAdmin and Postgres.app, which is confusing. I thought that those application depend on one another, but it does not seem so.
Postgres.app is a full-featured PostgreSQL installation packaged as a standard Mac app. It sets up a PostgreSQL database server on your computer when you install it.
PgAdmin is graphical user interface administration tool for PostgreSQL. It is a client tool for working with existing local or remote PostgreSQL servers. It does not include a PostgreSQL database server.

Migrating Postgresql 9.1 to 9.2 from an old server to a new server

In my old server, Postgresql 9.1 is installed and it contains a large scale of data. Now, I have got a new server and installed the latest version of Postgresql which is 9.2. I want to migrate the whole data from the old server to the new server. I looked at Postgresql documentation and there is a command to upgrade but it seems to explain upgrading in the same server. How could I approach for this matter?
I would be very careful about changing both hardware and major versions of PostgreSQL at the same time. If something goes wrong, it will greatly complicate figuring out what the problem is.
I do this as a two step process, first restore the database to the new server as the same version, then run pg_upgrade. That means you have to have both versions of the software installed on the new server simultaneously.
Dump the database with pg_dump and load it at the new server with psql. I think pg_upgrade is better as an in place procedure.