示例#1
0
 $zk_host = get_host_name($pdo, $cfg['zk_host_id']);
 if ($zk_host) {
     $zk = $zk_host . ":10" . $service_id;
     if (set_zk($pdo, $service_id, $zk)) {
         insert_action_queue_new($pdo, CREATE_ZK, $service_id, $cfg['zk_host_id'], $username);
     }
 }
 $host_list_select = get_host_list_select($pdo, '1024');
 $host_id = $host_list_select[0]['host_id'];
 $port_num = get_host_max_port_num($pdo, $host_id);
 if (!$port_num) {
     $port_num = 7801;
 } else {
     $port_num = $port_num + 1;
 }
 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);
示例#2
0
     break;
 case "do_add":
     $username = check_login($req_url);
     if (!isset($params['service_id']) || $params['service_id'] == '') {
         msg_redirect("back", 'Please Bind Service!');
     }
     $service_id = $params['service_id'];
     $service_info = pdo_get_service_byid($pdo, $service_id);
     $port_num = get_host_max_port_num($pdo, $params['host_id']);
     if (!$port_num) {
         //$port_num = 7701;
         $port_num = 7801;
     } else {
         $port_num = $port_num + 1;
     }
     if (get_instance_by_port($pdo, $params['host_id'], $port_num)) {
         msg_redirect("back", 'The port num has been exist in this host!');
     }
     $instance_attr['host_id'] = $params['host_id'];
     $instance_attr['solr_version'] = $service_info['solr_version'];
     $instance_attr['port_num'] = $port_num;
     $instance_attr['use_memory'] = $params['use_memory'];
     $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);