[db_berkeley] How to append data to berkeley db?

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

[db_berkeley] How to append data to berkeley db?

liuf
This post was updated on .
I'm trying to use db_berkeley module. When I want to append some data rows to table 'load_balancer', I have confused with the command 'opensipsdbctl bdb append <db> <datafile>'. How can I form the <datafile>?
My tried datafile as below.

datafile_example_1
=======================================================
METADATA_COLUMNS
id(int) group_id(int) dst_uri(str) resources(str) probe_mode(int) description(str)
METADATA_KEY

METADATA_READONLY
0
METADATA_LOGFLAGS
0
METADATA_DEFAULTS
NIL|0|NIL|NIL|0|''
1|1|sip:192.168.3.3:5060|0|''
2|1|sip:192.168.3.5:5062|0|''
3|2|sip:192.168.3.7:5064|0|''

=======================================================


datafile_example_2
=======================================================
1|1|sip:192.168.3.3:5060|0|''
2|1|sip:192.168.3.5:5062|0|''
3|2|sip:192.168.3.7:5064|0|''

=======================================================

After the 'append' command and replace load_balancer.new, I tried to startup opensips, but failed. In the opensips log, I can find some error of db_berkeley reading. My appended 'datafile' has some error?

Reply | Threaded
Open this post in threaded view
|

Re: db_berkeley append <db> <datafile>

Bogdan-Andrei Iancu
Hi,

The datafile is the file containing the table you want to append to .
OpenSIPS provides the structures for all the tables it uses.

In the source tree, see for example:
    scripts/db_berkeley/opensips/domain

or with data

    scripts/db_berkeley/opensips/version


Regards,
Bogdan

liuf wrote:

> I'm trying to use db_berkeley module. When I want to append some data rows to
> table 'load_balancer', I have confused with the command 'opensipsdbctl bdb
> append <db> <datafile>'. How can I form the <datafile>?
> My tried datafile as below.
>
> datafile_example_1
> =======================================================
> METADATA_COLUMNS
> id(int) group_id(int) dst_uri(str) resources(str) probe_mode(int)
> description(str)
> METADATA_KEY
>
> METADATA_READONLY
> 0
> METADATA_LOGFLAGS
> 0
> METADATA_DEFAULTS
> NIL|0|NIL|NIL|0|''
> 1|1|sip:192.168.3.3:5060|0|''
> 2|1|sip:192.168.3.5:5062|0|''
> 3|2|sip:192.168.3.7:5064|0|''
>
> =======================================================
>
>
> datafile_example_2
> =======================================================
> 1|1|sip:192.168.3.3:5060|0|''
> 2|1|sip:192.168.3.5:5062|0|''
> 3|2|sip:192.168.3.7:5064|0|''
>
> =======================================================
>
> After the 'append' command and replace load_balancer.new, I tried to startup
> opensips, but failed. In the opensips log, I can find some error of
> db_berkeley reading. My appended 'datafile' has some error?
>
>
>  


--
Bogdan-Andrei Iancu
www.voice-system.ro


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: db_berkeley append <db> <datafile>

liuf
I know this source directory, I have read all file in this directory before.

Can I put another question?

I found in SOURCE/scripts/db_berkeley/opensips, only load_balancer file has no METADATA_KEY info, is it right?

Because refer to document http://www.opensips.org/html/docs/modules/1.6.x/db_berkeley.html, METADATA_KEY is required.


load_balancer
==================================================
METADATA_COLUMNS
id(int) group_id(int) dst_uri(str) resources(str) probe_mode(int) description(str)
METADATA_KEY

METADATA_READONLY
0
METADATA_LOGFLAGS
0
METADATA_DEFAULTS
NIL|0|NIL|NIL|0|''
==================================================
Reply | Threaded
Open this post in threaded view
|

Re: db_berkeley append <db> <datafile>

Bogdan-Andrei Iancu
Hi,

you are right - I made a fix to solve this issue. SVN is update on
trunk, 1.6 and 1.5 branches.

This fix will be part of the new 1.6.2 release from tomorrow.

Thanks and regards,
Bogdan

liuf wrote:

> I know this source directory, I have read all file in this directory before.
>
> Can I put another question?
>
> I found in SOURCE/scripts/db_berkeley/opensips, only load_balancer file has
> no METADATA_KEY info, is it right?
>
> Because refer to document
> http://www.opensips.org/html/docs/modules/1.6.x/db_berkeley.html,
> METADATA_KEY is required.
>
>
> load_balancer
> ==================================================
> METADATA_COLUMNS
> id(int) group_id(int) dst_uri(str) resources(str) probe_mode(int)
> description(str)
> METADATA_KEY
>
> METADATA_READONLY
> 0
> METADATA_LOGFLAGS
> 0
> METADATA_DEFAULTS
> NIL|0|NIL|NIL|0|''
> ==================================================
>  


--
Bogdan-Andrei Iancu
www.voice-system.ro


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: db_berkeley append <db> <datafile>

liuf
Thanks.

Base svn revision 6624, I check files in db_berkeley/opensips/ again. I found the files which have no METADATA_KEY value as below:

  dialplan
  dr_gateways
  dr_groups
  dr_rules
  globalblacklist
  nh_sockets
  userblacklist

maybe you need fix them also.
Reply | Threaded
Open this post in threaded view
|

Re: db_berkeley append <db> <datafile>

Bogdan-Andrei Iancu
Hi Liu,

Right - thanks for the report. I also fixed these tables.

Regards,
Bogdan

liuf wrote:

> Thanks.
>
> Base svn revision 6624, I check files in db_berkeley/opensips/ again. I
> found the files which have no METADATA_KEY value as below:
>
>   dialplan
>   dr_gateways
>   dr_groups
>   dr_rules
>   globalblacklist
>   nh_sockets
>   userblacklist
>
> maybe you need fix them also.
>  


--
Bogdan-Andrei Iancu
www.voice-system.ro


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users