The Redis configuration should look something like this:
<entry key='forward.type'>redis</entry>
<entry key='forward.url'>redis://host:port</entry>
Спасибо.
А как выбрать номер БД в которую будет forward?
(select 1,2 ...)
Или по дефолту в 1 бд?
I think you can do something like this:
redis://host:port/database
Thank you very much!
I will try.
I would be very grateful if you would share the configuration about forwarding "Forwarding raw network data in the original format" and software "Automatic execution of the command by events".
Check other forum threads. Those have been discussed already.
Thank.
I started everything.
In Redis, it is obtained in the LIST traccar saves type.
And when Traccar creates a key of the LIST type, does it specify a limit on the length of the LIST ? Or should I make a wrapper and delete the old one?
Or as an option to use LTRIM ?
Here's the code if you're interested in more details on how it works:
We don't have any limits and we don't delete anything.
Yes, thanks.
The code uses lpush
.
So either need to write a wrapper to delete old records.
Or in PositionForwarderRedis.java
to do ltrim
jedis.ltrim(key, 100);
Otherwise, redis will grow rapidly and fall due to lack of memory.
try (Jedis jedis = new Jedis(url)) {
jedis.lpush(key, value);
jedis.ltrim(key, 100);
}
You can even put 100 in a configuration variable.
100 - the number of deleted entries in the LIST
Do you mean it's a number of positions we keep?
LTRIM обрежет список созданный LPUSH до 100 элементов
LTRIM x,y
x=100;
y=-1;
оставит последние x записей и обрежет после x записи до конца списка -1
В текущем варианте используется по сути создание мини-копии БД в памяти. Насколько это удобно будет при количестве устройств более 200 и сколько потребуется ресурсов в памяти.. По практике 200 устройств за месяц делают в mariadb около 10 гигабайт записей.
Могу предложить другой вариант.
Использовать SET и в качестве ключа будет uniq трекера. В json вложить таймштамп создания в redis.
В этом варианте будет всегда быстрый доступ к последним данным минуя api или sql.
We could make it configurable. Feel free to send a PR or create a ticket on GitHub.
Good afternoon.
What configuration should I use to make a forward for Redis with a choice of db Redis?
Or if possible, please write where you can see configuration examples for version 5.7.
(Auto-registration filtering by a regular expression,Automatic command triggering by events,Raw network data forwarding in original format etc)
Thanks.