osm-search / Nominatim

Open Source search based on OpenStreetMap data
https://nominatim.org
GNU General Public License v3.0
3.11k stars 713 forks source link

nominatim replication error #3393

Closed dominikhulla closed 5 months ago

dominikhulla commented 5 months ago

I have a problem when updating the database, if I run "nominatim replication --once" it throws this error, I don't know what to do

nominatim@geocoding:~/nominatim-project$ nominatim replication --once
2024-04-16 20:57:18: Using project directory: /srv/nominatim/nominatim-project
Traceback (most recent call last):
  File "/usr/local/bin/nominatim", line 12, in <module>
    exit(cli.nominatim(module_dir='/usr/local/lib/nominatim/module',
  File "/usr/local/lib/nominatim/lib-python/nominatim/cli.py", line 228, in nominatim
    return get_set_parser().run(**kwargs)
  File "/usr/local/lib/nominatim/lib-python/nominatim/cli.py", line 121, in run
    return args.command.run(args)
  File "/usr/local/lib/nominatim/lib-python/nominatim/clicmd/replication.py", line 199, in run
    self._update(args)
  File "/usr/local/lib/nominatim/lib-python/nominatim/clicmd/replication.py", line 154, in _update
    state = replication.update(dsn, params, socket_timeout=args.socket_timeout)
  File "/usr/local/lib/nominatim/lib-python/nominatim/tools/replication.py", line 136, in update
    run_osm2pgsql_updates(conn, options)
  File "/usr/local/lib/nominatim/lib-python/nominatim/tools/replication.py", line 152, in run_osm2pgsql_updates
    cur.execute('TRUNCATE place_to_be_deleted')
  File "/usr/local/lib/nominatim/lib-python/nominatim/db/connection.py", line 36, in execute
    super().execute(query, args)
  File "/usr/lib/python3/dist-packages/psycopg2/extras.py", line 146, in execute
    return super().execute(query, vars)
psycopg2.errors.UndefinedTable: relation "place_to_be_deleted" does not exist
mtmail commented 5 months ago

Can you give us more context other than the error message? Which version of the software, what kind of database, how was it imported, configuration ... What is the output of nominatim admin --check-database?

dominikhulla commented 5 months ago

Can you give us more context other than the error message? Which version of the software, what kind of database, how was it imported, configuration ... What is the output of nominatim admin --check-database?

Ubuntu 22.04.4 Nominatim 4.4.0 PostgreSQL 14.11

Reply from nominatim admin --check-database

`nominatim@geocoding:~/nominatim-project$ nominatim admin --check-database
2024-04-16 21:58:47: Using project directory: /srv/nominatim/nominatim-project
2024-04-16 21:58:47: Checking database
Checking database connection ... OK
Checking database_version matches Nominatim software version ... Failed
Database version (None) doesn't match Nominatim version (4.4.0-0)

Hints:
* Are you connecting to the correct database?

Check the Migration chapter of the Administration Guide.

Project directory: /srv/nominatim/nominatim-project
Current setting of NOMINATIM_DATABASE_DSN: pgsql:dbname=nominatim
dominikhulla commented 5 months ago

Snímka obrazovky 2024-04-17 000454

API call

mtmail commented 5 months ago

It's possible the current logged in user cannot access the database. Can you try sudo -u www-user nominatim admin --check-database or check if user nominatim has an account in postgresql? See createuser in https://nominatim.org/release-docs/latest/appendix/Install-on-Ubuntu-20/ for an example.

dominikhulla commented 5 months ago

It's possible the current logged in user cannot access the database. Can you try sudo -u www-user nominatim admin --check-database or check if user nominatim has an account in postgresql? See createuser in https://nominatim.org/release-docs/latest/appendix/Install-on-Ubuntu-20/ for an example.

i have nominatim user and www-data Snímka obrazovky 2024-04-17 181823

dominikhulla commented 5 months ago

I manualy add database_version and all works Snímka obrazovky 2024-04-17 193605 Snímka obrazovky 2024-04-17 193539