Я использую emqttd-windows 10-v2.3.11
Я хочу загрузить пользовательские плагины в EMQTT.
Я поместил файл плагина в каталог EMQTT \ emqttd-windows10-v2.3.11 \ emqttd \ lib, а файл конфигурации - в каталог EMQTT \ emqttd-windows 10-v2.3.11 \ emqttd \ etc \ plugins.
Следующая ошибка произошла, когда в CMD была запущена команда «.binemqttd console» для запуска EMQ. Ошибки могут означать, что EMQTT не может найти новые переменные в плагине.
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)
## 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
Ниже приводится содержимое файла синтаксического анализа моего файла конфигурации плагина (. Schema)
%% 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}.
Полный код плагина: https://files.cnblogs.com/files/wunaozai/emq_plugin_wunaozai.zip
Я надеюсь, что плагин загружается правильно при выполнении команды ". \ Bin \ emqttd console"