Erlang 添加插件后启动EMQ时出错:You';我试图设置XXX,但没有具有该名称的集合
我使用emqttd windows 10-v2.3.11 我想在EMQTT中加载自定义插件 我将插件文件放在EMQTT\emqttd-windows10-v2.3.11\emqttd\lib目录下,将配置文件放在EMQTT\emqttd-windows10-v2.3.11\emqttd\etc\plugins目录下 在CMD中执行“.binemqttd console”命令以启动EMQ时发生以下错误。错误可能意味着EMQTT无法在插件中找到新变量Erlang 添加插件后启动EMQ时出错:You';我试图设置XXX,但没有具有该名称的集合,erlang,emq,Erlang,Emq,我使用emqttd windows 10-v2.3.11 我想在EMQTT中加载自定义插件 我将插件文件放在EMQTT\emqttd-windows10-v2.3.11\emqttd\lib目录下,将配置文件放在EMQTT\emqttd-windows10-v2.3.11\emqttd\etc\plugins目录下 在CMD中执行“.binemqttd console”命令以启动EMQ时发生以下错误。错误可能意味着EMQTT无法在插件中找到新变量 D:\softwareBag\EMQTT\emq
D:\softwareBag\EMQTT\emqttd-windows10-v2.3.11\emqttd>.\bin\emqttd console
21:47:46.858 [error] You've tried to set wunaozai.auth.redis.server, but there is no setting with that name.
21:47:46.858 [error] Did you mean one of these?
21:47:46.906 [error] auth.redis.server
21:47:46.906 [error] auth.ldap.servers
21:47:46.906 [error] auth.mongo.server
21:47:46.906 [error] You've tried to set wunaozai.auth.redis.pool, but there is no setting with that name.
21:47:46.906 [error] Did you mean one of these?
21:47:46.948 [error] auth.redis.pool
21:47:46.948 [error] auth.mongo.pool
21:47:46.948 [error] auth.mysql.pool
21:47:46.949 [error] You've tried to set wunaozai.auth.redis.database, but there is no setting with that name.
21:47:46.949 [error] Did you mean one of these?
21:47:46.994 [error] auth.redis.database
21:47:46.994 [error] auth.mongo.database
21:47:46.994 [error] auth.mysql.database
21:47:46.995 [error] You've tried to set wunaozai.auth.redis.auth_cmd, but there is no setting with that name.
21:47:46.995 [error] Did you mean one of these?
21:47:47.056 [error] auth.redis.auth_cmd
21:47:47.056 [error] auth.redis.acl_cmd
21:47:47.056 [error] auth.redis.super_cmd
21:47:47.056 [error] You've tried to set wunaozai.auth.redis.password_hash, but there is no setting with that name.
21:47:47.057 [error] Did you mean one of these?
21:47:47.130 [error] auth.redis.password_hash
21:47:47.130 [error] auth.ldap.password_hash
21:47:47.130 [error] auth.mongo.auth_query.password_hash
21:47:47.130 [error] You've tried to set wunaozai.auth.redis.super_cmd, but there is no setting with that name.
21:47:47.130 [error] Did you mean one of these?
21:47:47.202 [error] auth.redis.super_cmd
21:47:47.202 [error] auth.redis.auth_cmd
21:47:47.202 [error] auth.redis.acl_cmd
21:47:47.202 [error] You've tried to set wunaozai.auth.redis.acl_cmd, but there is no setting with that name.
21:47:47.202 [error] Did you mean one of these?
21:47:47.266 [error] auth.redis.acl_cmd
21:47:47.266 [error] auth.redis.auth_cmd
21:47:47.266 [error] auth.redis.super_cmd
21:47:47.267 [error] You've tried to set wunaozai.msg.kafka.server, but there is no setting with that name.
21:47:47.267 [error] Did you mean one of these?
21:47:47.328 [error] auth.mongo.server
21:47:47.328 [error] auth.mysql.server
21:47:47.328 [error] auth.pgsql.server
21:47:47.336 [error] Error generating configuration in phase transform_datatypes
21:47:47.336 [error] Conf file attempted to set unknown variable: wunaozai.msg.kafka.server
21:47:47.336 [error] Conf file attempted to set unknown variable: wunaozai.auth.redis.acl_cmd
21:47:47.336 [error] Conf file attempted to set unknown variable: wunaozai.auth.redis.super_cmd
21:47:47.336 [error] Conf file attempted to set unknown variable: wunaozai.auth.redis.password_hash
21:47:47.336 [error] Conf file attempted to set unknown variable: wunaozai.auth.redis.auth_cmd
21:47:47.336 [error] Conf file attempted to set unknown variable: wunaozai.auth.redis.database
21:47:47.336 [error] Conf file attempted to set unknown variable: wunaozai.auth.redis.pool
21:47:47.336 [error] Conf file attempted to set unknown variable: wunaozai.auth.redis.server
我咨询过EMQTT客服人员,他们说插件配置文件和配置文件解析文件架构有问题,但我不知道有什么问题
以下是我的插件配置文件(.conf)的内容
以下是我的插件配置文件解析文件(.schema)的内容
%%emq\u auth\u pgsl配置映射
{映射,“auth.pgsql.server”,“emq_auth_pgsql.server”[
{默认值,{“127.0.0.1”,5432},
{datatype,[integer,ip,string]}
]}.
{映射,“auth.pgsql.pool”,“emq_auth_pgsql.server”[
{default,8},
{数据类型,整数}
]}.
{映射,“auth.pgsql.database”,“emq_auth_pgsql.server”[
{数据类型,字符串}
]}.
{映射,“auth.pgsql.username”,“emq_auth_pgsql.server”[
{default,“},
{数据类型,字符串}
]}.
{映射,“auth.pgsql.password”,“emq_auth_pgsql.server”[
{default,“},
{数据类型,字符串}
]}.
{映射,“auth.pgsql.encoding”,“emq_auth_pgsql.server”[
{default,utf8},
{datatype,atom}
]}.
{映射,“auth.pgsql.ssl”,“emq_auth_pgsql.server”[
{default,false},
{datatype,{enum,[true,false]}
]}.
{映射,“auth.pgsql.ssl_opts.keyfile”,“emq_auth_pgsql.server”[
{数据类型,字符串}
]}.
{映射,“auth.pgsql.ssl_opts.certfile”,“emq_auth_pgsql.server”[
{数据类型,字符串}
]}.
{映射,“auth.pgsql.ssl_opts.cacertfile”,“emq_auth_pgsql.server”[
{数据类型,字符串}
]}.
{翻译,“emq_auth_pgsql.server”,fun(Conf)->
{PgHost,PgPort}=
case cuttlefish:conf_get(“auth.pgsql.server”,conf)of
{Ip,Port}->{Ip,Port};
S->大小写字符串:的标记(“:”)
[Domain]>{Domain,5432};
[域,端口]->{Domain,list_to_integer(端口)}
结束
完,,
Pool=cartlefish:conf_get(“auth.pgsql.Pool”,conf),
Username=cartlefish:conf_get(“auth.pgsql.Username”,conf),
Passwd=cartlefish:conf_get(“auth.pgsql.password”,conf,”),
DB=cartlefish:conf_get(“auth.pgsql.database”,conf),
Encoding=cartlefish:conf_get(“auth.pgsql.Encoding”,conf),
Ssl=cartlefish:conf_get(“auth.pgsql.Ssl”,conf),
Filter=fun(选项)->[{K,V}|{K,V}
过滤器([{keyfile,cuttlefish:conf_get(前缀++“.keyfile”,conf,未定义)},
{certfile,乌贼:conf_get(前缀++“.certfile”,conf,未定义)},
{cacertfile,乌贼:conf_get(前缀++“.cacertfile”,conf,未定义)}])
完,,
[{pool_size,pool},
{自动重新连接,1},
{host,PgHost},
{port,PgPort},
{用户名,用户名},
{密码,Passwd},
{数据库,DB},
{编码,编码},
{ssl,ssl},
{ssl_opts,SslOpts(“auth.pgsql.ssl_opts”)}]
结束}。
{映射,“auth.pgsql.auth_查询”,“emq_auth_pgsql.auth_查询”[
{数据类型,字符串}
]}.
{映射,“auth.pgsql.password_hash”,“emq_auth_pgsql.password_hash”[
{数据类型,字符串}
]}.
{映射,“auth.pgsql.pbkdf2_macfun”,“emq_auth_pgsql.pbkdf2_macfun”[
{datatype,atom}
]}.
{映射,“auth.pgsql.pbkdf2_迭代”,“emq_auth_pgsql.pbkdf2_迭代”[
{数据类型,整数}
]}.
{映射,“auth.pgsql.pbkdf2_dklen”,“emq_auth_pgsql.pbkdf2_dklen”[
{数据类型,整数}
]}.
{映射,“auth.pgsql.super_query”,“emq_auth_pgsql.super_query”[
{数据类型,字符串}
]}.
{映射,“auth.pgsql.acl_查询”,“emq_auth_pgsql.acl_查询”[
{数据类型,字符串}
]}.
{翻译,“emq_auth_pgsql.password_hash”,fun(Conf)->
HashValue=cartlefish:conf_-get(“auth.pgsql.password_-hash”,conf),
大小写字符串:的标记(HashValue,“,”)
[散列]->列表到原子(散列);
[前缀,后缀]->{list_to_atom(前缀),list_to_atom(后缀)};
[散列,MacFun,迭代,Dklen]->{list_to_atom(散列),list_to_atom(MacFun),list_to_integer(迭代),list_to_integer(Dklen)};
_->平原
结束
结束}。
插件的完整代码:
我希望在执行命令“\bin\emqttd console”时插件能够正确加载。schema文件中应该有一个条目
wunaozai.auth.redis.server
将这些问题发布在上会得到更快的回答。在.schema文件中应该有一个条目
wunaozai.auth.redis.server
把这样的问题贴在上面会得到更快的回答
## redis config
wunaozai.auth.redis.server = 127.0.0.1:6379
wunaozai.auth.redis.pool = 8
wunaozai.auth.redis.database = 0
##wunaozai.auth.redis.password =
wunaozai.auth.redis.auth_cmd = HMGET mqtt_user:%u password
wunaozai.auth.redis.password_hash = plain
wunaozai.auth.redis.super_cmd = HGET mqtt_user:%u is_superuser
wunaozai.auth.redis.acl_cmd = HGETALL mqtt_acl:%u
## kafka config
wunaozai.msg.kafka.server = 127.0.0.1:9092
##wunaozai.msg.kafka.topic = test
%% emq_auth_pgsl config mapping
{mapping, "auth.pgsql.server", "emq_auth_pgsql.server", [
{default, {"127.0.0.1", 5432}},
{datatype, [integer, ip, string]}
]}.
{mapping, "auth.pgsql.pool", "emq_auth_pgsql.server", [
{default, 8},
{datatype, integer}
]}.
{mapping, "auth.pgsql.database", "emq_auth_pgsql.server", [
{datatype, string}
]}.
{mapping, "auth.pgsql.username", "emq_auth_pgsql.server", [
{default, ""},
{datatype, string}
]}.
{mapping, "auth.pgsql.password", "emq_auth_pgsql.server", [
{default, ""},
{datatype, string}
]}.
{mapping, "auth.pgsql.encoding", "emq_auth_pgsql.server", [
{default, utf8},
{datatype, atom}
]}.
{mapping, "auth.pgsql.ssl", "emq_auth_pgsql.server", [
{default, false},
{datatype, {enum, [true, false]}}
]}.
{mapping, "auth.pgsql.ssl_opts.keyfile", "emq_auth_pgsql.server", [
{datatype, string}
]}.
{mapping, "auth.pgsql.ssl_opts.certfile", "emq_auth_pgsql.server", [
{datatype, string}
]}.
{mapping, "auth.pgsql.ssl_opts.cacertfile", "emq_auth_pgsql.server", [
{datatype, string}
]}.
{translation, "emq_auth_pgsql.server", fun(Conf) ->
{PgHost, PgPort} =
case cuttlefish:conf_get("auth.pgsql.server", Conf) of
{Ip, Port} -> {Ip, Port};
S -> case string:tokens(S, ":") of
[Domain] -> {Domain, 5432};
[Domain, Port] -> {Domain, list_to_integer(Port)}
end
end,
Pool = cuttlefish:conf_get("auth.pgsql.pool", Conf),
Username = cuttlefish:conf_get("auth.pgsql.username", Conf),
Passwd = cuttlefish:conf_get("auth.pgsql.password", Conf, ""),
DB = cuttlefish:conf_get("auth.pgsql.database", Conf),
Encoding = cuttlefish:conf_get("auth.pgsql.encoding", Conf),
Ssl = cuttlefish:conf_get("auth.pgsql.ssl", Conf),
Filter = fun(Opts) -> [{K, V} || {K, V} <- Opts, V =/= undefined] end,
SslOpts = fun(Prefix) ->
Filter([{keyfile, cuttlefish:conf_get(Prefix ++ ".keyfile", Conf, undefined)},
{certfile, cuttlefish:conf_get(Prefix ++ ".certfile", Conf, undefined)},
{cacertfile, cuttlefish:conf_get(Prefix ++ ".cacertfile", Conf, undefined)}])
end,
[{pool_size, Pool},
{auto_reconnect, 1},
{host, PgHost},
{port, PgPort},
{username, Username},
{password, Passwd},
{database, DB},
{encoding, Encoding},
{ssl, Ssl},
{ssl_opts, SslOpts("auth.pgsql.ssl_opts")}]
end}.
{mapping, "auth.pgsql.auth_query", "emq_auth_pgsql.auth_query", [
{datatype, string}
]}.
{mapping, "auth.pgsql.password_hash", "emq_auth_pgsql.password_hash", [
{datatype, string}
]}.
{mapping, "auth.pgsql.pbkdf2_macfun", "emq_auth_pgsql.pbkdf2_macfun", [
{datatype, atom}
]}.
{mapping, "auth.pgsql.pbkdf2_iterations", "emq_auth_pgsql.pbkdf2_iterations", [
{datatype, integer}
]}.
{mapping, "auth.pgsql.pbkdf2_dklen", "emq_auth_pgsql.pbkdf2_dklen", [
{datatype, integer}
]}.
{mapping, "auth.pgsql.super_query", "emq_auth_pgsql.super_query", [
{datatype, string}
]}.
{mapping, "auth.pgsql.acl_query", "emq_auth_pgsql.acl_query", [
{datatype, string}
]}.
{translation, "emq_auth_pgsql.password_hash", fun(Conf) ->
HashValue = cuttlefish:conf_get("auth.pgsql.password_hash", Conf),
case string:tokens(HashValue, ",") of
[Hash] -> list_to_atom(Hash);
[Prefix, Suffix] -> {list_to_atom(Prefix), list_to_atom(Suffix)};
[Hash, MacFun, Iterations, Dklen] -> {list_to_atom(Hash), list_to_atom(MacFun), list_to_integer(Iterations), list_to_integer(Dklen)};
_ -> plain
end
end}.