<div dir="ltr">It worked. Thanks Man. <div><br></div><div>I am not sure why opensips user does not have read permissions. I had to grant that manually. </div><div><br></div><div>Ryan. </div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, 13 Feb 2020 at 15:31, Tekin, Arda <<a href="mailto:arda.tekin@afiniti.com">arda.tekin@afiniti.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div lang="EN-US">
<div class="gmail-m_-6426662126444962672WordSection1">
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Hi Ryan
<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">I have recently created the postgres tables by opensips-cli tool.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Copy the default.cfg under your home directory. (while I am root)<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">cp /root/src/opensips-cli/etc/default.cfg /root/opensips-cli.cfg<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">add postgres section in opensips-cli.cfg.
<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">The postgres password should be previously set by psql command.
<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">My file looks like this<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">[default]<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">log_level: WARNING<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">prompt_name: opensips-cli<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">prompt_intro: Welcome to OpenSIPS Command Line Interface!<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">prompt_emptyline_repeat_cmd: False<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">history_file: ~/.opensips-cli.history<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">history_file_size: 1000<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">output_type: pretty-print<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">communication_type: fifo<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">fifo_file: /tmp/opensips_fifo<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"># optional DB override instance, invoked using `opensips-cli -i postgres ...`<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">[postgres]<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">database_path: /usr/local/share/opensips/postgres<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">database_url: postgres://opensips:<postgres-password>@<db-ip>:5432<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">template_url: postgres://postgres:<postgres-password>@<db-ip>:5432<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">database_name: opensips<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Then run the following command to create all tables of opensips
<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">opensips-cli -f /root/opensips-cli.cfg -i postgres -x database create<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">opensips-cli uses the sql files in /usr/local/share/opensips/postgres path when creating tables.
<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Arda<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p>
<div>
<div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(225,225,225);padding:3pt 0in 0in">
<p class="MsoNormal"><b><span style="font-size:11pt;font-family:Calibri,sans-serif">From:</span></b><span style="font-size:11pt;font-family:Calibri,sans-serif"> Users <<a href="mailto:users-bounces@lists.opensips.org" target="_blank">users-bounces@lists.opensips.org</a>>
<b>On Behalf Of </b>Ryan embgrets<br>
<b>Sent:</b> Monday, February 10, 2020 12:22 AM<br>
<b>To:</b> <a href="mailto:users@lists.opensips.org" target="_blank">users@lists.opensips.org</a><br>
<b>Subject:</b> [OpenSIPS-Users] Cannot create opensips database for postgresql using opensips-cli<u></u><u></u></span></p>
</div>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<p style="margin:0in 0in 0.0001pt"><em><b><span style="color:blue">Attention:</span></b><span style="color:blue"> This email was sent from someone outside of Afiniti. Always use caution when opening attachments, clicking links from unknown senders
or when receiving unexpected emails.</span></em><u></u><u></u></p>
<p style="margin:0in 0in 0.0001pt"> <u></u><u></u></p>
<div>
<div>
<div>
<div>
<p class="MsoNormal">Greetings, <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">I am trying to create opensips database using opensips-cli module but each time it is failing. <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">I am getting below error during the process. <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<div>
<p class="MsoNormal">(opensips-cli): database create<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Please provide the URL of the SQL database: postgres://<a href="mailto:opensips%3Aopensipsrw@127.0.0.1" target="_blank">opensips:opensipsrw@127.0.0.1</a><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">ERROR: cannot connect to DB server: (psycopg2.OperationalError) FATAL: database "opensips" does not exist<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">!<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Traceback (most recent call last):<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> File "/usr/lib/python3.5/cmd.py", line 214, in onecmd<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> func = getattr(self, 'do_' + cmd)<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">AttributeError: 'OpenSIPSCLIShell' object has no attribute 'do_database'<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">During handling of the above exception, another exception occurred:<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Traceback (most recent call last):<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> File "/usr/lib/python3/dist-packages/sqlalchemy/pool.py", line 1044, in _do_get<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> return self._pool.get(wait, self._timeout)<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> File "/usr/lib/python3/dist-packages/sqlalchemy/util/queue.py", line 145, in get<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> raise Empty<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">sqlalchemy.util.queue.Empty<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">During handling of the above exception, another exception occurred:<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Traceback (most recent call last):<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 2074, in _wrap_pool_connect<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> return fn()<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> File "/usr/lib/python3/dist-packages/sqlalchemy/pool.py", line 318, in unique_connection<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> return _ConnectionFairy._checkout(self)<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> File "/usr/lib/python3/dist-packages/sqlalchemy/pool.py", line 713, in _checkout<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> fairy = _ConnectionRecord.checkout(pool)<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> File "/usr/lib/python3/dist-packages/sqlalchemy/pool.py", line 480, in checkout<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> rec = pool._do_get()<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> File "/usr/lib/python3/dist-packages/sqlalchemy/pool.py", line 1060, in _do_get<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> self._dec_overflow()<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> File "/usr/lib/python3/dist-packages/sqlalchemy/util/langhelpers.py", line 60, in __exit__<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> compat.reraise(exc_type, exc_value, exc_tb)<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> File "/usr/lib/python3/dist-packages/sqlalchemy/util/compat.py", line 186, in reraise<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> raise value<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> File "/usr/lib/python3/dist-packages/sqlalchemy/pool.py", line 1057, in _do_get<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> return self._create_connection()<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> File "/usr/lib/python3/dist-packages/sqlalchemy/pool.py", line 323, in _create_connection<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> return _ConnectionRecord(self)<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> File "/usr/lib/python3/dist-packages/sqlalchemy/pool.py", line 449, in __init__<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> self.connection = self.__connect()<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> File "/usr/lib/python3/dist-packages/sqlalchemy/pool.py", line 607, in __connect<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> connection = self.__pool._invoke_creator(self)<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> File "/usr/lib/python3/dist-packages/sqlalchemy/engine/strategies.py", line 97, in connect<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> return dialect.connect(*cargs, **cparams)<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> File "/usr/lib/python3/dist-packages/sqlalchemy/engine/default.py", line 385, in connect<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> return self.dbapi.connect(*cargs, **cparams)<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> File "/usr/lib/python3/dist-packages/psycopg2/__init__.py", line 126, in connect<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> conn = _connect(dsn, connection_factory=connection_factory, **kwasync)<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">psycopg2.OperationalError: FATAL: database "opensips" does not exist<u></u><u></u></p>
</div>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Any help here is much appreciated. <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Ryan. <u></u><u></u></p>
</div>
</div>
</div>
</div>
</div>
</div>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
</blockquote></div>