[OpenSIPS-Users] I am facing some issue while creating DB through opensips-cli .

Sasmita Panda spanda at 3clogic.com
Fri Nov 20 11:15:23 EST 2020


Ok .

DEBUG: using config file /root/.opensips-cli.cfg
DEBUG: Loaded module 'instance'
DEBUG: Loaded module 'trace'
DEBUG: Loaded module 'tls'
DEBUG: Loaded module 'mi'
DEBUG: sent command ':opensips_fifo_reply_20633:{"params": [], "jsonrpc":
"2.0", "method": "which", "id": "11598"}'
DEBUG: Loaded module 'diagnose'
DEBUG: Loaded module 'database'
DEBUG: Loaded module 'user'
DEBUG: Loaded module 'trap'
DEBUG: running in non-interactive mode '['database', 'create', 'opensips']'
DEBUG: running command 'create' '['opensips']'
DEBUG: db_name: 'opensips'
DEBUG: admin DB URL: 'mysql://root:cccl0g1c@localhost/opensips'
DEBUG: connecting to mysql://root:cccl0g1c@localhost/opensips
Traceback (most recent call last):
  File
"/usr/local/lib/python3.5/dist-packages/SQLAlchemy-1.3.3-py3.5-linux-x86_64.egg/sqlalchemy/engine/base.py",
line 2262, in _wrap_pool_connect
    return fn()
  File
"/usr/local/lib/python3.5/dist-packages/SQLAlchemy-1.3.3-py3.5-linux-x86_64.egg/sqlalchemy/pool/base.py",
line 303, in unique_connection
    return _ConnectionFairy._checkout(self)
  File
"/usr/local/lib/python3.5/dist-packages/SQLAlchemy-1.3.3-py3.5-linux-x86_64.egg/sqlalchemy/pool/base.py",
line 760, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File
"/usr/local/lib/python3.5/dist-packages/SQLAlchemy-1.3.3-py3.5-linux-x86_64.egg/sqlalchemy/pool/base.py",
line 492, in checkout
    rec = pool._do_get()
  File
"/usr/local/lib/python3.5/dist-packages/SQLAlchemy-1.3.3-py3.5-linux-x86_64.egg/sqlalchemy/pool/impl.py",
line 139, in _do_get
    self._dec_overflow()
  File
"/usr/local/lib/python3.5/dist-packages/SQLAlchemy-1.3.3-py3.5-linux-x86_64.egg/sqlalchemy/util/langhelpers.py",
line 68, in __exit__
    compat.reraise(exc_type, exc_value, exc_tb)
  File
"/usr/local/lib/python3.5/dist-packages/SQLAlchemy-1.3.3-py3.5-linux-x86_64.egg/sqlalchemy/util/compat.py",
line 129, in reraise
    raise value
  File
"/usr/local/lib/python3.5/dist-packages/SQLAlchemy-1.3.3-py3.5-linux-x86_64.egg/sqlalchemy/pool/impl.py",
line 136, in _do_get
    return self._create_connection()
  File
"/usr/local/lib/python3.5/dist-packages/SQLAlchemy-1.3.3-py3.5-linux-x86_64.egg/sqlalchemy/pool/base.py",
line 308, in _create_connection
    return _ConnectionRecord(self)
  File
"/usr/local/lib/python3.5/dist-packages/SQLAlchemy-1.3.3-py3.5-linux-x86_64.egg/sqlalchemy/pool/base.py",
line 437, in __init__
    self.__connect(first_connect_check=True)
  File
"/usr/local/lib/python3.5/dist-packages/SQLAlchemy-1.3.3-py3.5-linux-x86_64.egg/sqlalchemy/pool/base.py",
line 639, in __connect
    connection = pool._invoke_creator(self)
  File
"/usr/local/lib/python3.5/dist-packages/SQLAlchemy-1.3.3-py3.5-linux-x86_64.egg/sqlalchemy/engine/strategies.py",
line 114, in connect
    return dialect.connect(*cargs, **cparams)
  File
"/usr/local/lib/python3.5/dist-packages/SQLAlchemy-1.3.3-py3.5-linux-x86_64.egg/sqlalchemy/engine/default.py",
line 453, in connect
    return self.dbapi.connect(*cargs, **cparams)
  File "/usr/lib/python3/dist-packages/MySQLdb/__init__.py", line 81, in
Connect
    return Connection(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/MySQLdb/connections.py", line 204,
in __init__
    super(Connection, self).__init__(*args, **kwargs2)
_mysql_exceptions.OperationalError: (1049, "Unknown database 'opensips'")

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File
"/usr/local/lib/python3.5/dist-packages/opensipscli-0.1.0-py3.5.egg/opensipscli/db.py",
line 136, in __init__
    self.__conn = self.__engine.connect().\
  File
"/usr/local/lib/python3.5/dist-packages/SQLAlchemy-1.3.3-py3.5-linux-x86_64.egg/sqlalchemy/engine/base.py",
line 2193, in connect
    return self._connection_cls(self, **kwargs)
  File
"/usr/local/lib/python3.5/dist-packages/SQLAlchemy-1.3.3-py3.5-linux-x86_64.egg/sqlalchemy/engine/base.py",
line 103, in __init__
    else engine.raw_connection()
  File
"/usr/local/lib/python3.5/dist-packages/SQLAlchemy-1.3.3-py3.5-linux-x86_64.egg/sqlalchemy/engine/base.py",
line 2293, in raw_connection
    self.pool.unique_connection, _connection
  File
"/usr/local/lib/python3.5/dist-packages/SQLAlchemy-1.3.3-py3.5-linux-x86_64.egg/sqlalchemy/engine/base.py",
line 2266, in _wrap_pool_connect
    e, dialect, self
  File
"/usr/local/lib/python3.5/dist-packages/SQLAlchemy-1.3.3-py3.5-linux-x86_64.egg/sqlalchemy/engine/base.py",
line 1536, in _handle_dbapi_exception_noconnection
    util.raise_from_cause(sqlalchemy_exception, exc_info)
  File
"/usr/local/lib/python3.5/dist-packages/SQLAlchemy-1.3.3-py3.5-linux-x86_64.egg/sqlalchemy/util/compat.py",
line 383, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb, cause=cause)
  File
"/usr/local/lib/python3.5/dist-packages/SQLAlchemy-1.3.3-py3.5-linux-x86_64.egg/sqlalchemy/util/compat.py",
line 128, in reraise
    raise value.with_traceback(tb)
  File
"/usr/local/lib/python3.5/dist-packages/SQLAlchemy-1.3.3-py3.5-linux-x86_64.egg/sqlalchemy/engine/base.py",
line 2262, in _wrap_pool_connect
    return fn()
  File
"/usr/local/lib/python3.5/dist-packages/SQLAlchemy-1.3.3-py3.5-linux-x86_64.egg/sqlalchemy/pool/base.py",
line 303, in unique_connection
    return _ConnectionFairy._checkout(self)
  File
"/usr/local/lib/python3.5/dist-packages/SQLAlchemy-1.3.3-py3.5-linux-x86_64.egg/sqlalchemy/pool/base.py",
line 760, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File
"/usr/local/lib/python3.5/dist-packages/SQLAlchemy-1.3.3-py3.5-linux-x86_64.egg/sqlalchemy/pool/base.py",
line 492, in checkout
    rec = pool._do_get()
  File
"/usr/local/lib/python3.5/dist-packages/SQLAlchemy-1.3.3-py3.5-linux-x86_64.egg/sqlalchemy/pool/impl.py",
line 139, in _do_get
    self._dec_overflow()
  File
"/usr/local/lib/python3.5/dist-packages/SQLAlchemy-1.3.3-py3.5-linux-x86_64.egg/sqlalchemy/util/langhelpers.py",
line 68, in __exit__
    compat.reraise(exc_type, exc_value, exc_tb)
  File
"/usr/local/lib/python3.5/dist-packages/SQLAlchemy-1.3.3-py3.5-linux-x86_64.egg/sqlalchemy/util/compat.py",
line 129, in reraise
    raise value
  File
"/usr/local/lib/python3.5/dist-packages/SQLAlchemy-1.3.3-py3.5-linux-x86_64.egg/sqlalchemy/pool/impl.py",
line 136, in _do_get
    return self._create_connection()
  File
"/usr/local/lib/python3.5/dist-packages/SQLAlchemy-1.3.3-py3.5-linux-x86_64.egg/sqlalchemy/pool/base.py",
line 308, in _create_connection
    return _ConnectionRecord(self)
  File
"/usr/local/lib/python3.5/dist-packages/SQLAlchemy-1.3.3-py3.5-linux-x86_64.egg/sqlalchemy/pool/base.py",
line 437, in __init__
    self.__connect(first_connect_check=True)
  File
"/usr/local/lib/python3.5/dist-packages/SQLAlchemy-1.3.3-py3.5-linux-x86_64.egg/sqlalchemy/pool/base.py",
line 639, in __connect
    connection = pool._invoke_creator(self)
  File
"/usr/local/lib/python3.5/dist-packages/SQLAlchemy-1.3.3-py3.5-linux-x86_64.egg/sqlalchemy/engine/strategies.py",
line 114, in connect
    return dialect.connect(*cargs, **cparams)
  File
"/usr/local/lib/python3.5/dist-packages/SQLAlchemy-1.3.3-py3.5-linux-x86_64.egg/sqlalchemy/engine/default.py",
line 453, in connect
    return self.dbapi.connect(*cargs, **cparams)
  File "/usr/lib/python3/dist-packages/MySQLdb/__init__.py", line 81, in
Connect
    return Connection(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/MySQLdb/connections.py", line 204,
in __init__
    super(Connection, self).__init__(*args, **kwargs2)
sqlalchemy.exc.OperationalError: (_mysql_exceptions.OperationalError)
(1049, "Unknown database 'opensips'")
(Background on this error at: http://sqlalche.me/e/e3q8)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/opensips-cli", line 4, in <module>
    __import__('pkg_resources').run_script('opensipscli==0.1.0',
'opensips-cli')
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line
719, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line
1504, in run_script
    exec(code, namespace, namespace)
  File
"/usr/local/lib/python3.5/dist-packages/opensipscli-0.1.0-py3.5.egg/EGG-INFO/scripts/opensips-cli",
line 9, in <module>
    run_console()
  File
"/usr/local/lib/python3.5/dist-packages/opensipscli-0.1.0-py3.5.egg/EGG-INFO/scripts/opensips-cli",
line 6, in run_console
    main.main()
  File
"/usr/local/lib/python3.5/dist-packages/opensipscli-0.1.0-py3.5.egg/opensipscli/main.py",
line 78, in main
    sys.exit(shell.cmdloop())
  File
"/usr/local/lib/python3.5/dist-packages/opensipscli-0.1.0-py3.5.egg/opensipscli/cli.py",
line 242, in cmdloop
    ret = self.run_command(self.command[0], command, params)
  File
"/usr/local/lib/python3.5/dist-packages/opensipscli-0.1.0-py3.5.egg/opensipscli/cli.py",
line 357, in run_command
    return mod[0].__invoke__(cmd, params)
  File
"/usr/local/lib/python3.5/dist-packages/opensipscli-0.1.0-py3.5.egg/opensipscli/module.py",
line 36, in __invoke__
    return f(params)
  File
"/usr/local/lib/python3.5/dist-packages/opensipscli-0.1.0-py3.5.egg/opensipscli/modules/database.py",
line 369, in do_create
    admin_db = self.get_db(admin_url, db_name)
  File
"/usr/local/lib/python3.5/dist-packages/opensipscli-0.1.0-py3.5.egg/opensipscli/modules/database.py",
line 630, in get_db
    return osdb(db_url, db_name)
  File
"/usr/local/lib/python3.5/dist-packages/opensipscli-0.1.0-py3.5.egg/opensipscli/db.py",
line 160, in __init__
    raise osdbError("unable to connect to the database")
opensipscli.db.osdbError: unable to connect to the database

This happens when I am giving a file path .


*Thanks & Regards*
*Sasmita Panda*
*Senior Network Testing and Software Engineer*
*3CLogic , ph:07827611765*


On Fri, Nov 20, 2020 at 4:17 PM Liviu Chircu <liviu at opensips.org> wrote:

> On 20.11.2020 12:43, Sasmita Panda wrote:
> > DEBUG: DB 'opensips' exists
> > DEBUG: Creating standard tables
> > DEBUG: checking tables: acc alias_db auth_db avpops clusterer dialog
> > dialplan dispatcher domain drouting group load_balancer msilo
> > permissions rtpproxy rtpengine speeddial tls_mgm usrloc
>
> OK, it seems your "default.cfg" file is not picked up, so the CLI uses
> its built-in paths:
>
> * "database_schema_path = /usr/share/opensips", which probably points to
> some 2.4 scripts ("uri" table?!)
> * "database_modules" is missing, so it's using the "standard" list of
> tables
>
> Please move that "default.cfg" file to the proper path, or specify it as
> an argument.  It is the 1st thing mentioned in the documentation [1]
>
> Happy hacking,
>
> [1]: https://github.com/opensips/opensips-cli#configuration
>
> --
> Liviu Chircu
> www.twitter.com/liviuchircu | www.opensips-solutions.com
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20201120/c68a2865/attachment-0001.html>


More information about the Users mailing list