diff --git a/agc_2-X/trunk/bin/ADMIN_keepalive_ALL.pl b/agc_2-X/trunk/bin/ADMIN_keepalive_ALL.pl index ccb91b22..d2cb1fba 100644 --- a/agc_2-X/trunk/bin/ADMIN_keepalive_ALL.pl +++ b/agc_2-X/trunk/bin/ADMIN_keepalive_ALL.pl @@ -52,6 +52,7 @@ # 100312-1012 - Changed TIMEOUT Call Menu function to work with AGI routes # 100424-2121 - Added codecs options for phones # 100616-2245 - Added VIDPROMPT options for call menus, changed INGROUP TIMECHECK routes to special extension like AGI +# 100703-2137 - Added memory table reset nightly # $DB=0; # Debug flag @@ -529,6 +530,10 @@ foreach(@conf) {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_custom_user/) && ($CLIDB_custom_user < 1) ) + {$VARDB_custom_user = $line; $VARDB_custom_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_custom_pass/) && ($CLIDB_custom_pass < 1) ) + {$VARDB_custom_pass = $line; $VARDB_custom_pass =~ s/.*=//gi;} if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} $i++; @@ -733,6 +738,29 @@ if ($timeclock_end_of_day_NOW > 0) @aryA = $sthA->fetchrow_array; if ($DB) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} $sthA->finish(); + + + $dbhC = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_custom_user", "$VARDB_custom_pass") + or die "Couldn't connect to database: " . DBI->errstr; + + ##### find MEMORY tables for reset of empty space ##### + $stmtA = "SHOW TABLE STATUS WHERE Engine='MEMORY';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $i=0; + while ($sthArows > $i) + { + @aryA = $sthA->fetchrow_array; + $table_name = $aryA[0]; + + $stmtC = "ALTER TABLE $table_name ENGINE=MEMORY;"; + if($DBX){print STDERR "\n|$stmtC|\n";} + $Caffected_rows = $dbhC->do($stmtC); + if($DB){print STDERR "\n|$table_name memory reset $Caffected_rows rows|\n";} + $i++; + } + $sthA->finish(); } ################################################################################ diff --git a/agc_2-X/trunk/docs/BASE_INSTALL.txt b/agc_2-X/trunk/docs/BASE_INSTALL.txt index ea9caf26..66ed8a7f 100644 --- a/agc_2-X/trunk/docs/BASE_INSTALL.txt +++ b/agc_2-X/trunk/docs/BASE_INSTALL.txt @@ -256,6 +256,9 @@ GRANT SELECT,INSERT,UPDATE,DELETE,LOCK TABLES on asterisk.* TO cron@localhost ID GRANT RELOAD ON *.* TO cron@'%'; GRANT RELOAD ON *.* TO cron@localhost; +GRANT ALTER,CREATE on asterisk.* TO custom@'%' IDENTIFIED BY 'custom1234'; +GRANT ALTER,CREATE on asterisk.* TO custom@localhost IDENTIFIED BY 'custom1234'; + flush privileges; use asterisk; @@ -303,6 +306,18 @@ server, you will need to edit either the /etc/astguiclient.conf file or the dbconnect.php files in the astguiclient, vicidial and agc directories of your webroot. +NOTE: if you have a dedicated MySQL database server with a lot of RAM(8GB or + greater) then you should consider running the following MySQL queries to + turn heavily used tables into MEMORY tables to speed up execution and reduce + load on your database server: + ALTER TABLE vicidial_live_agents MODIFY closer_campaigns VARCHAR(8000) default ''; + ALTER TABLE vicidial_live_agents MODIFY external_ingroups VARCHAR(8000) default ''; + ALTER TABLE vicidial_live_agents MODIFY agent_territories VARCHAR(1000) default ''; + ALTER TABLE vicidial_live_agents ENGINE=MEMORY; + ALTER TABLE vicidial_manager ENGINE=MEMORY; + + + 3. Enter the astguiclient administration page: http://10.10.10.15/vicidial/admin.php NOTE: if you click on the Logout button you must leave the user/pass empty and click OK diff --git a/agc_2-X/trunk/docs/LOAD_BALANCING.txt b/agc_2-X/trunk/docs/LOAD_BALANCING.txt index fbff36d8..d4d6f03b 100644 --- a/agc_2-X/trunk/docs/LOAD_BALANCING.txt +++ b/agc_2-X/trunk/docs/LOAD_BALANCING.txt @@ -24,6 +24,16 @@ NOTE: as of 2.0.5 most of these settings are already done for you if you are usi NOTE: as of SVN trunk 2009-05-19 the voicemail and prompt recording extensions are also auto-generated +NOTE: if you have a dedicated MySQL database server with a lot of RAM(8GB or greater) then you should consider running the following MySQL queries to turn heavily used tables into MEMORY tables to speed up execution and reduce load on your database server: + + ALTER TABLE vicidial_live_agents MODIFY closer_campaigns VARCHAR(8000) default ''; + ALTER TABLE vicidial_live_agents MODIFY external_ingroups VARCHAR(8000) default ''; + ALTER TABLE vicidial_live_agents MODIFY agent_territories VARCHAR(1000) default ''; + + ALTER TABLE vicidial_live_agents ENGINE=MEMORY; + + ALTER TABLE vicidial_manager ENGINE=MEMORY; + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! diff --git a/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql b/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql index 5cf2a5f6..92b788f0 100644 --- a/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql +++ b/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql @@ -2131,17 +2131,19 @@ field_order SMALLINT(5) default '1' CREATE UNIQUE INDEX listfield on vicidial_lists_fields (list_id, field_label); -ALTER TABLE vicidial_campaign_server_stats ENGINE=HEAP; +ALTER TABLE vicidial_campaign_server_stats ENGINE=MEMORY; -ALTER TABLE live_channels ENGINE=HEAP; +ALTER TABLE live_channels ENGINE=MEMORY; -ALTER TABLE live_sip_channels ENGINE=HEAP; +ALTER TABLE live_sip_channels ENGINE=MEMORY; -ALTER TABLE parked_channels ENGINE=HEAP; +ALTER TABLE parked_channels ENGINE=MEMORY; -ALTER TABLE server_updater ENGINE=HEAP; +ALTER TABLE server_updater ENGINE=MEMORY; -ALTER TABLE web_client_sessions ENGINE=HEAP; +ALTER TABLE web_client_sessions ENGINE=MEMORY; + +ALTER TABLE vicidial_auto_calls ENGINE=MEMORY; UPDATE system_settings SET auto_user_add_value='1101'; @@ -2269,7 +2271,7 @@ ALTER TABLE vicidial_agent_log_archive MODIFY agent_log_id INT(9) UNSIGNED NOT N CREATE TABLE vicidial_carrier_log_archive LIKE vicidial_carrier_log; -UPDATE system_settings SET db_schema_version='1231',db_schema_update_date=NOW(); +UPDATE system_settings SET db_schema_version='1232',db_schema_update_date=NOW(); GRANT RELOAD ON *.* TO cron@'%'; GRANT RELOAD ON *.* TO cron@localhost; diff --git a/agc_2-X/trunk/extras/upgrade_2.4.sql b/agc_2-X/trunk/extras/upgrade_2.4.sql index f7c15ea3..f5fd7ae1 100644 --- a/agc_2-X/trunk/extras/upgrade_2.4.sql +++ b/agc_2-X/trunk/extras/upgrade_2.4.sql @@ -399,3 +399,7 @@ ALTER TABLE vicidial_campaigns MODIFY get_call_launch ENUM('NONE','SCRIPT','WEBF ALTER TABLE vicidial_inbound_groups MODIFY get_call_launch ENUM('NONE','SCRIPT','WEBFORM','WEBFORMTWO','FORM') default 'NONE'; UPDATE system_settings SET db_schema_version='1231',db_schema_update_date=NOW(); + +ALTER TABLE vicidial_auto_calls ENGINE=MEMORY; + +UPDATE system_settings SET db_schema_version='1232',db_schema_update_date=NOW();