Replies: 3 comments
-
Wouldn't the CLI be started and compiled for each geocoding request? |
Beta Was this translation helpful? Give feedback.
-
To run installed nominatim cli binary under a virtual environment, you can simply run it against the venv's python binary, e.g:
If you do insist on editing
The sudo part really isn't needed. Just make sure that the files in For the access to the database, I would advise to make users use the read-only user, if they are only supposed to send queries. If not configured otherwise that would be the 'www-data' user. Instead of changing the trust-level in your database, you can also give this user a password and use a password-based access:
(The 'port' is important here because it makes the library switch from socket-based to a TCP-based connection which uses different trust levels.) All that said, I concur with @mtmail that you might still be faster with talking to a server, especially if you configure and use keep-alive properly. |
Beta Was this translation helpful? Give feedback.
-
@mtmail I thought that, but I have a big problem. @lonvia running the cli binary under python binary with the DSN parameter worked fine, a much easier solution than I initially thought.
About that, each connection this application receives creates a new thread, and each thread makes a request to the API, so I'm not sure if I can set up a keep-alive for this in the given time. I know that this network problem will be solved by refactoring the code of these old applications, and we are working on that, but it will not be in the time the company has given for the task. Thank you for your responses and suggestions. |
Beta Was this translation helpful? Give feedback.
-
I was facing some problems when trying to use nominatim commands on others user instead of "nominatim":
What I did to solve this:
I changed the file
/usr/local/bin/nominatim
:This solve my venv problem and also sets the correct user for DB access.
I needed to give user permissions to run commands as nominatim user, so added this line in the end of
/etc/sudoers
:With this, all users can now execute this command (nominatim) as user nominatim (without using sudo su ...) .
And finally I needed to solve "peer authentication" error by editing the file
/etc/postgresql/14/main/pg_hba.conf
:I added that line, so that users can now login as nominatim user without problems.
Important note: the nominatim user configuration needs to be defined before the config for all users, as postgresql will use the first valid configuration when trying to access the DB.
I did this because I'm using an Java application and it need to make reverse requests. As the server receive many connections (1k-10k/second) TCP and UDP I thought that using CLI would be much better than configure the API and making requests to it, leaving all the "network space" for the external connections to the server
I couldn't find anything related to this use case or anyone having the same problem, so I'm not sure if this is the best aproach for this problem. So, If anyone have any tips, warning, advices, anything, I'd be glad to listen.
Beta Was this translation helpful? Give feedback.
All reactions