改进 Edge
This commit is contained in:
parent
35e707c01e
commit
2658591079
@ -1,3 +1,4 @@
|
|||||||
|
#!/usr/bin/env php
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
||||||
@ -8,24 +9,6 @@ $node_id = '{{NODE_ID}}';
|
|||||||
$nginx_conf_path = '/path/to/api.laecloud.com.conf';
|
$nginx_conf_path = '/path/to/api.laecloud.com.conf';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** 自动生成的配置文件,如有变动,按照需求编辑。 **/
|
/** 自动生成的配置文件,如有变动,按照需求编辑。 **/
|
||||||
$redis_info = [
|
$redis_info = [
|
||||||
'host' => '{{REDIS_HOST}}',
|
'host' => '{{REDIS_HOST}}',
|
||||||
@ -145,11 +128,9 @@ while (true) {
|
|||||||
try {
|
try {
|
||||||
if (!$redis->exists($prefix . 'cluster:nodes')) {
|
if (!$redis->exists($prefix . 'cluster:nodes')) {
|
||||||
output('cluster:nodes not found');
|
output('cluster:nodes not found');
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
} catch (RedisException $e) {
|
} catch (RedisException $e) {
|
||||||
output('redis is error');
|
output('redis is error');
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$nodes = redis_hgetAll('nodes');
|
$nodes = redis_hgetAll('nodes');
|
||||||
@ -302,7 +283,7 @@ function redis_hset($key, $hash_key, $value)
|
|||||||
try {
|
try {
|
||||||
$redis->hset($prefix . 'cluster:' . $key, $hash_key, json_encode($value));
|
$redis->hset($prefix . 'cluster:' . $key, $hash_key, json_encode($value));
|
||||||
} catch (RedisException $e) {
|
} catch (RedisException $e) {
|
||||||
exit('redis get error: '.$e->getMessage());
|
echo 'redis get error: ' . $e->getMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -313,7 +294,7 @@ function redis_hdel($key, $hash_key): void
|
|||||||
try {
|
try {
|
||||||
$redis->hdel($prefix . 'cluster:' . $key, $hash_key);
|
$redis->hdel($prefix . 'cluster:' . $key, $hash_key);
|
||||||
} catch (RedisException $e) {
|
} catch (RedisException $e) {
|
||||||
exit('redis get error: '.$e->getMessage());
|
echo 'redis get error: ' . $e->getMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -335,6 +316,6 @@ function redis_publish($event, $message = []): void
|
|||||||
try {
|
try {
|
||||||
$redis->publish($prefix . 'cluster_ready', $data);
|
$redis->publish($prefix . 'cluster_ready', $data);
|
||||||
} catch (RedisException $e) {
|
} catch (RedisException $e) {
|
||||||
exit('redis publish error: '.$e->getMessage());
|
echo 'redis publish error: ' . $e->getMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user