Вы находитесь на странице: 1из 6

ODOO Setting

Firewall Port Setting

root@Odoo-KV-sgp1-01:~# sudo ufw status

Status: active

To Action From

-- ------ ----

6010/tcp ALLOW Anywhere

5432/tcp ALLOW Anywhere

8070/tcp ALLOW Anywhere

6010/tcp (v6) ALLOW Anywhere (v6)

5432/tcp (v6) ALLOW Anywhere (v6)

8070/tcp (v6) ALLOW Anywhere (v6)

FW port seting PG DB2


root@PGDB2-KV-sgp1-01:~# sudo ufw status

Status: active

To Action From

-- ------ ----

22/tcp ALLOW Anywhere

6010/tcp ALLOW Anywhere

8070/tcp ALLOW Anywhere

Anywhere ALLOW 159.89.203.153

Anywhere ALLOW 206.189.149.81

5432/tcp ALLOW Anywhere


22/tcp (v6) ALLOW Anywhere (v6)

6010/tcp (v6) ALLOW Anywhere (v6)

8070/tcp (v6) ALLOW Anywhere (v6)

5432/tcp (v6) ALLOW Anywhere (v6)

FW port seting PG DB1


root@PGDB-KV-sgp1-01:~# sudo ufw status

Status: active

To Action From

-- ------ ----

5432/tcp ALLOW Anywhere

6010/tcp ALLOW Anywhere

Anywhere ALLOW 206.189.151.156

Anywhere ALLOW 206.189.149.81

22 ALLOW Anywhere

5432/tcp (v6) ALLOW Anywhere (v6)

6010/tcp (v6) ALLOW Anywhere (v6)

22 (v6) ALLOW Anywhere (v6)

Hostname AssignmentPermalink

Node Hostname FQDN

Odoo 11 odoo odoo.yourdomain.com

PostgreSQL Master masterdb masterdb.yourdomain.com

PostgreSQL Slave slavedb slavedb.yourdomain.com

/etc/host untuk Odoo


127.0.1.1 Odoo-KV-sgp1-01 Odoo-KV-sgp1-01

127.0.0.1 localhost

127.0.1.2 erp.kvputih.id erp

159.89.203.153 pg1.kvputih.id pg1

206.189.151.156 pg2.kvputih.id pg2

/etc/hosts untuk PG DB1


127.0.1.1 PGDB-KV-sgp1-01 PGDB-KV-sgp1-01

127.0.0.1 localhost

127.0.1.2 pg1.kvputih.id pg1

/etc/hosts untuk PG DB2


127.0.1.1 PGDB2-KV-sgp1-01 PGDB2-KV-sgp1-01

127.0.0.1 localhost

127.0.1.2 pg2.kvputih.id pg2

159.89.203.153 pg1.kvputih.id pg1

206.189.149.81 erp.kvputih.id erp

206.189.151.156 pg2.kvputih.id pg2

206.189.149.81 erp.kvputih.id erp

Install PostgreSQLPermalink

PostgreSQL version 9.6 offers significant improvements for database replication, but
unfortunately, it is not included in the default Ubuntu 16.04 repositories. Install the newest
version on all database nodes.
Add the official PostgreSQL-Xenial repository to your system:

sudo add-apt-repository "deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main"

Import the repository key:

wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -

Update apt cache:

sudo apt update

Install PostgreSQL 9.6 in the database nodes:

sudo apt install postgresql-9.6 postgresql-server-dev-9.6

Create PostgreSQL UsersPermalink

Begin with the PostgreSQL user needed for Odoo communications. Create this user on both
Master and Slave nodes. Switch to the postgres user and create the database user odoo in
charge of all operations. Use a strong password and save it in a secure location, you will need it
later:

sudo -u postgres createuser odoo -U postgres -dRSP

Use the same password for the Odoo postgres user on all nodes. Odoo is not aware of database
replication, so it will be easier to trigger an eventual failover procedure if both servers share the
same information.

Now you need to create the replicauser on the Master node:

sudo -u postgres createuser replicauser -U postgres -P --replication

The replicauser user has fewer privileges than the odoo user because the replicauser’s only
purpose is to allow the Slave to read information from the Master nodes. The --replication
option grants the required privilege that replicauser need to perform its job.

Configure Host Based AuthenticationPermalink


Stop the PostgreSQL service on all nodes:

sudo systemctl stop postgresql


Edit pg_hba.conf to allow PostgreSQL nodes to communicate with each other. Add the following
lines to the Master database server:

# Tambahan entry

host replication replicauser 206.189.151.156/32 md5

host all odoo 206.189.149.81/32 md5

/etc/postgresql/9.6/main/pg_hba.conf

root@PGDB-KV-sgp1-01:~# cat /etc/postgresql/9.6/main/pg_hba.conf

# Tambahan entry

host replication replicauser 206.189.151.156/32 md5

host all odoo 206.189.149.81/32 md5

root@PGDB2-KV-sgp1-01:~# cat /etc/postgresql/9.6/main/pg_hba.conf

# Tambahan entry

host all odoo erp.kvputih.id md5

Each line provides the client authentication permissions to connect to a specific database. For
example, the first line allows the Slave to connect to the Master node using replicauser, and the
second line grants the odoo user the rights connect to all databases within this server.

Add a similar configuration to the Slave node, this will make it easier to promote it to master
status if necessary:

/etc/postgresql/9.6/main/pg_hba.conf

host all odoo odoo.yourdomain.com md5

The settings in the pg_hba.conf file are:


host: Enables connections using Unix-domain sockets.

replication: Specifies a replication connection for the given user. No database name is required
for this type of connection.

replicauser: The user created in the previous section.

md5: Make use of client-supplied MD5-encrypted password for authentication.

all: Match all databases in the server. You could provide specific Odoo database names
(separated by commas if more than one) if you know them beforehand.

odoo: The Odoo user responsible for application/database communications.

Вам также может понравиться