Difference between revisions of "Menggunakan opensipsdbctl"

From OnnoWiki
Jump to navigation Jump to search
Line 13: Line 13:
 
  DBNAME=opensips
 
  DBNAME=opensips
 
  DBRWUSER=opensips
 
  DBRWUSER=opensips
 +
 +
Copy opensipsdbctl.mysql
 +
 +
# cp /usr/local/src/opensips-1.5.0-tls/scripts/opensipsdbctl.mysql /usr/local/lib/opensips/opensipsctl/
 +
  
 
Pastikan MySQL beroperasi
 
Pastikan MySQL beroperasi
Line 19: Line 24:
 
  # /etc/init.d/mysql restart
 
  # /etc/init.d/mysql restart
  
Buat MySQL database
+
Help file
 +
 
 +
# opensipsdbctl -h
 +
MySQL password for root:
 +
/usr/local/sbin/opensipsdbctl $Revision: 3997 $
 +
 
 +
usage: opensipsdbctl create <db name or db_path, optional> .....(creates a new database)
 +
        opensipsdbctl drop <db name or db_path, optional> .......(!entirely deletes tables!)
 +
        opensipsdbctl reinit <db name or db_path, optional> .....(!entirely deletes and than re-creates tables!)
 +
        opensipsdbctl backup <file> .................................(dumps current database to file)
 +
        opensipsdbctl restore <file> ................................(restores tables from a file)
 +
        opensipsdbctl copy <new_db> .................................(creates a new db from an existing one)
 +
        opensipsdbctl migrate <old_db> <new_db> .....................(migrates DB from 1.2 to 1.3, not implemented yet!)
 +
        opensipsdbctl presence ......................................(adds the presence related tables)
 +
        opensipsdbctl extra .........................................(adds the extra tables)
 +
 
 +
        if you want to manipulate database as other database user than
 +
        root, want to change database name from default value "opensips",
 +
        or want to use other values for users and password, edit the
 +
        "config vars" section of the command opensipsdbctl.
 +
 
 +
 
 +
Membuat database opensips
 +
 
 +
# opensipsdbctl create
 +
 
 +
MySQL password for root:
 +
INFO: test server charset
 +
INFO: creating database opensips ...
 +
INFO: Core OpenSIPS tables succesfully created.
 +
 
 +
Install presence related tables? (y/n): y
 +
 
 +
INFO: creating presence tables into opensips ...
 +
INFO: Presence tables succesfully created.
 +
 
 +
Install tables for imc cpl siptrace domainpolicy carrierroute userblacklist? (y/n): y
  
  # mysql -u root -p
+
  INFO: creating extra tables into opensips ...
Enter password:
+
  INFO: Extra tables succesfully created.
mysql> create database opensips;
 
mysql> grant INSERT,SELECT on root.* to opensips@localhost;
 
mysql> grant CREATE, INSERT, SELECT, DELETE, UPDATE on opensips.* to opensips@localhost identified by 'opensipspass';
 
  mysql> grant CREATE, INSERT, SELECT, DELETE, UPDATE on opensips.* to opensips identified by 'opensipspass';
 
mysql> exit
 

Revision as of 17:15, 27 March 2009

Setup database

# vi /usr/local/etc/opensips/opensipsctlrc 

atau

# vi /etc/opensips/opensipsctlrc 

Pastikan

DBENGINE=MYSQL
DBHOST=localhost
DBNAME=opensips
DBRWUSER=opensips

Copy opensipsdbctl.mysql

# cp /usr/local/src/opensips-1.5.0-tls/scripts/opensipsdbctl.mysql /usr/local/lib/opensips/opensipsctl/


Pastikan MySQL beroperasi

$ sudo su -
# /etc/init.d/mysql restart

Help file

# opensipsdbctl -h
MySQL password for root: 
/usr/local/sbin/opensipsdbctl $Revision: 3997 $
usage: opensipsdbctl create <db name or db_path, optional> .....(creates a new database)
       opensipsdbctl drop <db name or db_path, optional> .......(!entirely deletes tables!)
       opensipsdbctl reinit <db name or db_path, optional> .....(!entirely deletes and than re-creates tables!)
       opensipsdbctl backup <file> .................................(dumps current database to file)
       opensipsdbctl restore <file> ................................(restores tables from a file)
       opensipsdbctl copy <new_db> .................................(creates a new db from an existing one)
       opensipsdbctl migrate <old_db> <new_db> .....................(migrates DB from 1.2 to 1.3, not implemented yet!)
       opensipsdbctl presence ......................................(adds the presence related tables)
       opensipsdbctl extra .........................................(adds the extra tables)
       if you want to manipulate database as other database user than 
       root, want to change database name from default value "opensips",
       or want to use other values for users and password, edit the
       "config vars" section of the command opensipsdbctl.


Membuat database opensips

# opensipsdbctl create
MySQL password for root: 
INFO: test server charset
INFO: creating database opensips ...
INFO: Core OpenSIPS tables succesfully created.
Install presence related tables? (y/n): y
INFO: creating presence tables into opensips ...
INFO: Presence tables succesfully created.
Install tables for imc cpl siptrace domainpolicy carrierroute userblacklist? (y/n): y
INFO: creating extra tables into opensips ...
INFO: Extra tables succesfully created.