Beispiel #1
0
function reload_instance($pdo, $instance_id, $username = '')
{
    if (lock_instance($pdo, $instance_id)) {
        insert_action_queue($pdo, INSTANCE_RECONFIGURE_JETTY, $instance_id, $username);
        insert_action_queue($pdo, INSTANCE_RECONFIGURE_SCHEMA, $instance_id, $username);
        insert_action_queue($pdo, INSTANCE_RECONFIGURE_SOLRCONF, $instance_id, $username);
        insert_action_queue($pdo, INSTANCE_STOP, $instance_id, $username);
        insert_action_queue($pdo, INSTANCE_START, $instance_id, $username);
    }
}
Beispiel #2
0
         if (get_instance_by_port($pdo, $host_id, $port_num)) {
             msg_redirect("back", 'The port num has been exist in this host!');
         }
         $instance_attr['host_id'] = $host_id;
         $instance_attr['solr_version'] = $service_info['solr_version'];
         $instance_attr['port_num'] = $port_num;
         $instance_attr['use_memory'] = $cfg['auto_instance_mem'];
         $instance_id = insert_instance($pdo, $instance_attr);
         if ($instance_id) {
             $jetty_attr['jetty.port'] = $port_num;
             $jetty_attr['instance_id'] = $instance_id;
             insert_jetty_config($pdo, $jetty_attr);
         }
         if (lock_instance($pdo, $instance_id)) {
             insert_action_queue($pdo, INSTANCE_DEPLOY, $instance_id, $username);
             insert_action_queue($pdo, INSTANCE_RECONFIGURE_JETTY, $instance_id, $username);
         }
         //bind service
         $lb_weight = '';
         update_instance_lb_weight($pdo, $instance_id, $lb_weight);
         add_instance_into_service($pdo, $instance_id, $service_id, $username);
         $instance_list = get_instance_list_complex($pdo, array('service_id' => $service_id));
     }
     $template = 'service_done';
     //msg_redirect('service_detail.php?service_id='.$service_id);
     break;
 case 'change_mode':
     //service.php?action=change_mode&service_id=$service_id
     $service_id = $params['service_id'];
     $username = check_login($req_url);
     $service_info = pdo_get_service_byid($pdo, $service_id);
Beispiel #3
0
$now_hour = date("G");
$services = get_service_list_running($link);
if (!$services) {
    exit;
}
foreach ($services as $s) {
    if (empty($s["optimize_time"])) {
        continue;
    }
    $hours = explode(",", $s["optimize_time"]);
    foreach ($hours as $i => $h) {
        $hours[$i] = intval($h);
    }
    if (!in_array($now_hour, $hours)) {
        continue;
    }
    #    $instances = pdo_get_instances($link, $s["service_id"]);
    #    if (!$instances) continue;
    #
    #    foreach ($instances as $i) {
    #        if ($i["writable"]==0) continue;
    #
    #        insert_action_queue($link, INSTANCE_OPTIMIZE, $i["instance_id"], 'Robot');
    #    }
    #   考虑到多master的情况(选第一个writable=1的instance)
    $master = pdo_get_master_complex($link, $s["service_id"]);
    if (!$master) {
        continue;
    }
    insert_action_queue($link, INSTANCE_OPTIMIZE, $master["instance_id"], 'Robot');
}