I am using tilelite to serve up maps. I need it to run at the time the server is started. I have built a script that runs the following command at startup:
/usr/local/bin/liteserv.py /home/Uname/bin/mapnik/my_osm.xml --caching --debug=False
The process is failing with:
FATAL: Ident authentication failed for user "user_name" (encountered during parsing of layer 'leisure')
According to this page:
http://wiki.openstreetmap.org/wiki/Mapnik#Authentication_failed
I ran the following command:
./generate_xml.py osm.xml my_osm.xml --accept-none --dbname gis --symbols ./symbols/ --world_boundaries ./world_boundaries/
Now I get:
RuntimeError: PSQL error:
FATAL: Ident authentication failed for user "root" (encountered during parsing of layer 'leisure')
I am really new to postgres so could someone give me some very simple insructions on how to fix this.
If you call ./generate_xml.py --help you will see the various options. One of them is --user. If you do not supply it and also pass --accept-none then no specific user will be written into the Mapnik XML, which means that when Mapnik attempts to connect to the postgres database the current user will be used. So, if you run that script as root, 'root' will be used.
So, you need to either run that script as a unix user that can connect to postgres, or you need to go back and regenerate the XML and embed the name of a user that can connect to postgres. The latter is likely easier. Here is what I would do:
Assuming your normal unix use is named 'heman' do:
$ sudo su postgres
$ createuser heman # make superuser
$ exit
$ ./generate_xml.py osm.xml --accept-none --user heman --dbname gis --symbols ./symbols/ --world_boundaries ./world_boundaries/
$ liteserv.py osm.xml --caching --debug=False
More details on postgres and how to enable "trust" so that you can connect as the "postgres" user here: http://dbsgeo.com/foss4g2010/html/troubleshooting.html#troubleshooting-postgresql-connections
Related
I am creating a local Label Studio server to host images to annotate in our office. I would like the database back end to be postgresql and not sqlite and be located in a particular directory, not the default and not the same as the 'data-dir'. I have got a test server working across the network with various machines annotating images on the server, but the backend was sqlite for this test.
Everything I've tried to get a postgresql backend db has failed for various reasons. Some commands result in a sqlite db (occasionally with the name 'postgresql') located in my required directory; others create postgres/pyscopg2 errors but I think they're up a garden path.
The host machine is running Ubuntu 20.04 LTS. And serves another postgresql db over the network using other APIs. Postgresql version running is 12.9.
I have created a conda environment and pip installed Label Studio as the documentation suggested.
Here's what I've tried:
Start the conda environment. Follow instructions to assign environment variables from https://labelstud.io/guide/storedata.html#PostgreSQL-database which at time of writing is:
DJANGO_DB=default
POSTGRE_NAME=postgres
POSTGRE_USER=postgres
POSTGRE_PASSWORD=
POSTGRE_PORT=5432
POSTGRE_HOST=db
Then a few variations on the start command (I didn't include the backslashes, just put here for readability/comparability):
label-studio start --init \
-db postgresql \
--database /path/to/label-studio/databases/newdb \
--data-dir /path/to/label-studio/media_dirs/test_proj
result: db is where expected, but:
file newdb
gives "newdb: SQLite 3.x database, last written using SQLite version 3038002"
label-studio start --init \
--database /path/to/label-studio/databases/newdb \
-db postgresql \
--data-dir /path/to/label-studio/media_dirs/test_proj
result: a db at specified path named 'postgresql' and still an sqlite db. This seems to mirror the mistake mentioned at: https://github.com/heartexlabs/label-studio/issues/1660
I have also tried the above two commands with the '--init' argument omitted with same results.
Then I tried adding something on the front of the command suggested at the same link above:
DJANGO_DB=default label-studio start \
--database /path/to/label-studio/databases/newdb \
--data-dir /path/to/label-studio/media_dirs/test_proj
result: psycopg2.OperationalError: FATAL: password authentication failed for user "postgres"
FATAL: password authentication failed for user "postgres"
DJANGO_DB=default POSTGRE_PASSWORD= label-studio start \
--database /path/to/label-studio/databases/newdb \
--data-dir /path/to/label-studio/media_dirs/test_proj
result: psycopg2.OperationalError: fe_sendauth: no password supplied
Any help and resolution would be highly appreciated.
Also, I can't tag this with 'label-studio' because I'm not quite at the required reputation to create a new tag, so if anyone who can feels like doing so, pleaseandthankyou!
Your last option was closer than all the others. Have you tried to run LS using this:
DJANGO_DB=default POSTGRE_NAME=<postgres_name> POSTGRE_USER=<postgres_user> POSTGRE_PASSWORD=<password> POSTGRE_PORT=<db_port> POSTGRE_HOST=<db_host> label-studio
Sure, you have to run postgres service by yourself, configure it properly, create the DB <postgres_name>, the user <postgres_user> and set the password <password>, grant access rights to this user. Also don't forget to specify <db_host> (localhost?), <db_port> (5432?)
I installed Homebrew and used it to install GDAL from within Ubuntu. After the installation finished, I'm still running into the following error: "'ogr2ogr/ogrinfo/gdalinfo' is not recognized as an internal or external command, operable program, or batch file" anytime I try using ogr2ogr, gdalinfo --version, or ogrinfo --help in command prompt. If I run those in Ubuntu, the error message reads "command not found."
Does this mean the installation did not work correctly? Would you advise to try reinstalling GDAL?
(The end goal is to use ogr2ogr to import a shapefile into postgres, eventually running
ogr2ogr -f "PostgreSQL" PG:"host=myhost user=myloginname dbname=mydbname password=mypassword" mytabfile.tab as advised by the documentation.)
If you're simply trying to import shapefiles into PostgreSQL, you might wanna take a look at shp2pgsql. It's quite simple - if you have the luxury of choosing the import tool :)
Data sample: TM_WORLD_BORDERS_SIMPL-0.3.zip
After unpacking your zip file just execute the following line in your console:
$ shp2pgsql -I -s 4326 TM_WORLD_BORDERS_SIMPL-0.3.shp table_world | psql -d mydb
Things to take into account:
table_world is the name of the target table
psql -d mydb takes into account that your current operating system user has an account in the database, that no password is required, that the database is installed at localhost and that it listens at the the standard port 5432. Check the psql documentation to build your own connection command, e.g. psql -U myuser -h 192.168.1.42 -p 5434 -d mydb to login with the user myuser in the database mydb in the remote PostgreSQL at 192.168.1.42 that listens at the port 5434. In case your PostgreSQL isn't configured to accept connections, check this answer.
4326 is the identifier for WGS84, which is the spatial reference system of this shapefile - and the most often used worldwide.
.. and your data is ready to be played with, e.g. import into QGIS:
Further reading: psql, shp2pgsql tutorial
I am new to Saleor and I followed all the step in the documentation. However I can't seem to create a new user. I have install PostgreSQL 11 using a .dmg file downloaded from the official website.
Every time I run createuser --superuser --pwprompt <username> I get bash: createuser: command not found.
If I try to install PostgreSQL with "brew install Postgres" and then run createuser --superuser --pwprompt <username>, I get asked for password twice for the new role then a third time which I have tried to many time to enter with no success. I get the error FATAL: password authentication failed for user <terminal username>.
I'm using VS code
I am trying to create a user in Postgresql 9.5 on FreeBSD 11. I am also trying to automate the whole thing with Vagrant and I have almost succeeded except for the creation of the user. I am using the createuser command with a password, and with that, I have attempted to use expect command in order to send the password to the prompt but I continue to receive the following error message:
"default: createdb: could not connect to database template1: FATAL: role "root" does not exist"
Here is the code sample that I am using:
# Create the database and the user
PASS=password
expect << EOF
spawn createuser -sdrP capstone
expect "Enter password for new role:"
send "${PASS}\r"
expect "Enter it again:"
send "${PASS}\r"
expect eof;
EOF
I am not too sure what else to try in regards to overcome this error, any help would be appreciated.
Do not run this script as root.
By default user "pgsql" has the permissions.
Switch to user:
su -l pgsql
Then run your expect script.
i have a problem with Openerp, can you help me please ?
ERROR ? openerp.sql_db: Connection to the database failed
Traceback (most recent call last):
File "/opt/openerp/server/openerp/sql_db.py", line 440, in borrow
result = psycopg2.connect(dsn=dsn, connection_factory=PsycoConnection)
OperationalError: fe_sendauth: no password supplied
Check your /etc/openerp/openerp-server.conf and make sure you have at least the following options set:
db_host = (usually localhost)
db_port = (usually 5432)
db_user =
db_password =
Try connecting to your database manually by running:
psql -d postgres -U <YOUR DATABASE USERNAME> -W
If this works (you should get a prompt like "postgres=>", exit it by pressing ctrl+d) but the error is still there in OpenERP, its probably because you run Ubuntu/Debian and you just installed your OpenERP package. The error appears because the init script are not able to kill the first openerp Python process started by dpkg automatically after the package installation. To fix this, run:
# ps aux|grep openerp
You will see a line that looks something like this:
openerp 14438 0.3 0.8 235096 69060 ? Sl 03:23 0:00 /usr/bin/python /usr/bin/openerp-server --config=/etc/openerp/openerp-server.conf --logfile=/var/log/openerp/openerp-server.log
The first number is the pid of the Python process. Kill the process by running:
kill -9 14438
Then restart your openerp server again by running:
/etc/init.d/openerp restart
Your openerp-server.conf should now be re-read by OpenERP and the error should disappear.
Search Google and Stack Overflow for "fe_sendauth: no password supplied".
Your PostgreSQL is set up to require a password for the (address,database,user) combination you're connecting with and you aren't sending a password.
You can learn more by reading the Client Authentication chapter of the PostgreSQL documentation.
create a postgres user using this command.
make sure the user is named same to your system user.
sudo su postgres
createuser -d -S -R <your system user>
psql
alter user <your system user> with password <your password>;
Hope it will resolve your issue to establish connection with database.
Go to your opererp-server.conf and look for addons_path. Make sure you have /openerp/addons and /openerp/web/addons. if you have something else just take it off and restart your server. It will work.