Hi Sayed!

Meanwhile I've managed to create such a script as:

PGSQL_HOST=<pgsql_host>
PGSQL_PORT=<pgsql_port>
PGSQL_USERNAME=<pgsql_username>
PGSQL_DB=<pgsql_database>
PGSQL_DLR_TABLE=<pgsql_dlr_table>
DLR_TTL=604800

echo "SELECT 'HMSET \"bb_dlr:'||smsc||':'||ts||'\" smsc \"'||smsc||'\" ts 
\"'||ts||'\" source \"'||source||'\" destination \"'||destination||'\" service 
\"'||service||'\" url \"'||url||'\" mask \"'||mask||'\" boxc \"'||boxc||'\" 
status \"'||status||'\"' from $PGSQL_DLR_TABLE where creationdate > NOW() - 
INTERVAL '$DLR_TTL second' UNION SELECT 'EXPIRE \"bb_dlr:'||smsc||':'||ts||'\" 
'|| trunc(extract(epoch from NOW() - creationdate)) from $PGSQL_DLR_TABLE where 
creationdate > NOW() - INTERVAL '$DLR_TTL second';" | psql --set ON_ERROR_STOP 
-h $PGSQL_HOST -p $PGSQL_PORT -U $PGSQL_USERNAME $PGSQL_DB -At | sort -k2,2 
-k1,1r | redis-cli -u "$REDIS_URL" --pipe

Of course this will depend on the field names defined in the PGSQL table and in 
REDIS, but is quite simple to migrate.

Best regards,

Paulo Correia
Head of Development

telephone:+351210337760 fax: +351210337761
email: paulo.corr...@go4mobility.com<mailto:paulo.corr...@go4mobility.com> 
skype: pcorreia.g4m

[assinatura_email_go4mobility_comlogo]<https://go4mobility.com/en/>

[assinatura_email_go4mobility_followus]<https://www.linkedin.com/company/go4mobility/>

_____________________________________________________________________________________________

CONFIDENTIALITY

This message, as well as existing attached files, may be confidential and 
privileged. Use or disclosure by anyone other than an intended recipient is not 
authorised.

If you have received this message by error, you are kindly requested to delete 
it and notify the sender. Thank you for your cooperation.

<https://go4mobility.com/en>


________________________________
From: Sayed Hadi Rastgou Haghi <hadi.rast...@gmail.com>
Sent: 05 March 2021 16:58
To: Paulo Correia <paulo.corr...@go4mobility.com>
Cc: users@kannel.org <users@kannel.org>
Subject: Re: Migrate dlr store on PostgreSQL to Redis


CAUTION: External E-mail


Hi Paulo,
You should write a migration tool. based on redis and PostgreSQL formats. It's 
straight forward based on your configs.

On Wed, Nov 18, 2020 at 3:18 PM Paulo Correia 
<paulo.corr...@go4mobility.com<mailto:paulo.corr...@go4mobility.com>> wrote:
Hi Kannel Users,

Has anyone migrated a Kannel instance with dlr store in PostgreSQL to Redis?
How to migrate the records in the dlr store tablet?

Kind regards,
Paulo Correia

Obter o Outlook para Android<https://aka.ms/ghei36>


--
Sincerely,

Sayed Hadi Rastgou Haghi

Reply via email to