4
votes

I configured odoo in aws ec2 and connecting Postgresql from rds when I run the command ./odoo-bin --config=/etc/odoo.conf and try to access from a browser, I'm getting the following error:

ERROR odoo_db odoo.modules.loading: Database odoo_db not initialized, you can force it with `-i base` 

File "/opt/odoo/odoo/odoo/modules/registry.py", line 176, in __getitem__
    return self.models[model_name]
KeyError: 'ir.http' - - -

and also I'm getting this error as well:

STATEMENT:  SELECT latest_version FROM ir_module_module WHERE name='base'
ERROR odoo_db odoo.sql_db: bad query: SELECT latest_version FROM ir_module_module WHERE name='base'
ERROR: relation "ir_module_module" does not exist
3
This is not a connection error, I think the message is that you selected a database that the base module is not installed on it. If it's not a valid database just drop it manually. or force odoo to go to db selection link ` /web/database/manager` and create a valid databaseCharif DZ
@EasyOdoo ..still getting this error File "/opt/odoo/odoo/odoo/modules/registry.py", line 176, in getitem return self.models[model_name] KeyError: 'ir.http' - - -coder
@EasyOdoo .When i changed odoo12 to odoo11 .everything is fixed .. but not i am getting this error Logged into database odoo_test, but dbfilter rejects it; logging session out.. actually in my odoo-wsgi file the actual database is shtechcoder

3 Answers

5
votes

In command line run:

 ./odoo-bin --addons-path=addons --database=odoo  --db_user=odoo --db_password=odoo  --db_host=localhost --db_port=5432 -i INIT

explicitly give db name, user and password, "-i INIT" option initialises the odoo database

0
votes

The first glance issue is though the DB has created in Postgres but it has not the required odoo related setup records i.e. base setup. You can verify by directly accessing the DB and see the number of tables or browsing some tables.

It happens sometimes that you create the DB [specifically giving similar DB names as you have already created before and deleted later [its dropped from PG but still has traces in session or DB location path], it will not get initialized properly.

Solution:

  1. Create sample DB with different name initial 4 characters different completely and check
  2. Initialize the DB from odoo.conf file add db_name = < Your DB Name > {for experiment purpose put completely different name} and restart odoo services and check

Hope it will help. Njoy troubleshooting!

0
votes

First do what @FaisalAnsari says in here (what I reference below):

*

Go to RDS and create a database in PostgreSQL and configure the server.conf file as the given below.


;This is the password that allows database operations:

;admin_passwd = admin

db_host = rds_endpoint (after creating database you will get
rds_endpoint)

db_port = False

db_user = "user name which is created by you to the database"

db_password = "password which is created"

;addons_path =
/home/deadpool/workspace/odoo_13_community/custom_addons,
/home/deadpool/workspace/odoo_13_community/custom_addons 

Then go to the command line and do the following.

  1. Stop your odoo instance
~$ service odoo stop
  1. Enable command line for the user odoo
~$ chsh -s /bin/bash odoo
  1. execute odoo from command line as user odoo
~$ runuser -l odoo -c "odoo -i base -d YourRDSDatabase --db_host YourAmazonRDSHost.Address.rds.amazonaws.com -r YourRDSDatabaseUserName -w YourRDSDatabasePassword --stop-after-init"
  1. After the initialization finished, start odoo service
~$ service odoo start

Troubleshooting :

if odoo doesn't start correctly make sure that the database user in your RDS instance have privileges at least on the database you are using.

~$ psql --host=YourAmazonRDSHost.Address.rds.amazonaws.com --port=5432 --username=YourRDSDatabaseUserName --password --dbname=YourRDSDatabase

and when you are inside postgresql type the following:

~$ grant all privileges on database YourRDSDatabase to YourRDSDatabaseUserName;

~$ \q

and try again from step 3.

Hope that Helps!!