foreach ($cfg['lb_host'] as $key => $v) { $target_id = $v; insert_action_queue_new($pdo, SERVICE_RECONFIGURE, $service_id, $target_id, $username); insert_action_queue_new($pdo, SERVICE_RELOAD, $service_id, $target_id, $username); } if ($cfg["puppet"]["enable"]) { insert_action_queue($pdo, XMLRPC_RECONFIGURE, 0, $username); insert_action_queue($pdo, XMLRPC_RELOAD, 0, $username); } } service_redirect(); break; case 'reload': $username = check_login($def_url); $service_id = $params['service_id']; if (lock_service($pdo, $service_id) || $service_id == 0) { foreach ($cfg['lb_host'] as $key => $v) { $target_id = $v; insert_action_queue_new($pdo, SERVICE_RECONFIGURE, $service_id, $target_id, $username); insert_action_queue_new($pdo, SERVICE_RELOAD, $service_id, $target_id, $username); } if ($cfg["puppet"]["enable"]) { insert_action_queue($pdo, XMLRPC_RECONFIGURE, 0, $username); insert_action_queue($pdo, XMLRPC_RELOAD, 0, $username); } } service_redirect(); break; case 'restart_all': $username = check_login($def_url); $service_id = $params['service_id'];
function reload_service_by_instance($pdo, $instance_id, $uname = '') { global $cfg; /*readable/writable被修改,需要修改instance的solrconfig.重启成功后再修改nginx*/ reload_instance($pdo, $instance_id, $uname); $service_mapping = pdo_get_mapping_by_instance_id($pdo, $instance_id); lock_service($pdo, $service_mapping['service_id']); foreach ($cfg['lb_host'] as $key => $v) { $target_id = $v; insert_action_queue_new($pdo, SERVICE_RECONFIGURE, $service_mapping['service_id'], $target_id, $uname); insert_action_queue_new($pdo, SERVICE_RELOAD, $service_mapping['service_id'], $target_id, $uname); } }