Hello,
I want to perform *ejabberd_sql:sql_query* on another database server by define another config in ejabberd.yml as this :
hosts:
- "chatserver.com"
host_config:
"chatserver.com":
sql_type: pgsql
sql_server: "localhost"
sql_database: "ejabberd"
sql_username: "postgres"
sql_password: "postgres"
sql_port: 5432
auth_method: [sql]
"another.chatserver.com":
sql_type: pgsql
sql_server: "another.chatserver.com"
sql_database: "anotherdb"
sql_username: "postgres"
sql_password: "postgres"
sql_port: 5432
So when i tried to query :
ejabberd_sql:sql_query(
<<"another.chatserver.com">>,
?SQL("SELECT @(password)s FROM users WHERE id=%(LUser)s")).
I have this following error :
Reason = {error,{{badmatch,{error,<<"Unknown Host">>}}
Please help or advice of how to perform a sql query on another database in ejabberd module.
Well, you can define a new
Well, you can define a new host in hosts, that you will use only to setup another database in it, and use it in oyur custom code:
Well, you can define a new
Well, you can define a new host in hosts, that you will use only to setup another database in it, and use it in oyur custom code:
If i defined another host
If i defined another host then i cannot start the server, encountered this problem :
11:32:39.340 [critical] Problem starting the module mod_http_upload for host another.chatserver.com
options: [{host,<<"upload.chatserver.com">>},
{access,local},
{thumbnail,true},
{docroot,<<"/var/www/html/upload">>},
{put_url,<<"https://chatserver.com:5443/upload">>},
{get_url,<<"https://chatserver.com/upload">>}]
error: {error,{already_started,<0.558.0>}}
[{gen_mod,start_module,3,[{file,"src/gen_mod.erl"},{line,198}]},
{lists,foreach,2,[{file,"lists.erl"},{line,1337}]},
{gen_mod,start_link,0,[{file,"src/gen_mod.erl"},{line,76}]},
{supervisor,do_start_child,2,[{file,"supervisor.erl"},{line,358}]},
{supervisor,start_children,3,[{file,"supervisor.erl"},{line,341}]},
{supervisor,init_children,2,[{file,"supervisor.erl"},{line,307}]},
{gen_server,init_it,6,[{file,"gen_server.erl"},{line,328}]},
{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,240}]}]
Show your mod_http_upload
Show your mod_http_upload configuration
mod_http_upload: host:
So, ejabberd has two vhosts,
So, ejabberd has two vhosts, and it will start mod_http_upload for each vhost trying to serve "upload.chatserver.com". When it will start the second module instance, it will complain. Both module instances will attempt to serve the same upload host, and that isn't possible.
Try to use this instead:
Alternative: use the option append_host_config: to define that module only in one vhost
https://docs.ejabberd.im/admin/configuration/#virtual-hosting
Thanks for kindness, yes it
Thanks for kindness, yes it is working for me with an alternative option you advised. i moved mod_http_upload, mod_pubsub and mod_mix to chatserver.com