问题描述
GCP 中的网络负载平衡。
使用的系统:3台服务器系统-> Nginx PHP-fpm(使用实例组) NFS。 Nginx NFS
现在我使用了健康检查,但有时健康检查会重新启动仍在运行并通过网络的应用程序,但方式不是很好(意味着有时 PHP-fpm 运行不顺畅,无法通过 Nginx),这发生在 12 月 23 日2020,在那之前。运行非常流畅。
PS:我将 Jakarta DC 用于 GCP。 当我在实例组中的一台服务器的串行上看到时出错:
1 月 26 日 10:17:50 PHP-backend-8s46 collectd[1532]: write_gcm: curl_easy_perform() 失败:已达到超时 Jan 26 10:18:33 PHP-backend-8s46 collectd[1532]: write_gcm: 与端点交谈时出错。 1 月 26 日 10:18:45 PHP-backend-8s46 collectd [1532]: write_gcm: wg_transmit_unique_segment 失败。 1 月 26 日 10:18:55 PHP-backend-8s46 collectd [1532]: write_gcm: wg_transmit_unique_segments 失败。冲洗。 Jan 26 10:19:00 PHP-backend-8s46 collectd[1532]: write_gcm: 不能取无限值 1 月 26 日 10:20:07 PHP-backend-8s46 collectd [1532]: write_gcm: wg_typed_value_create_from_value_t_inline 交换/百分比/值失败!继续。 Jan 26 10:21:08 PHP-backend-8s46 collectd[1532]: write_gcm: 不能取无限值 1 月 26 日 10:21:55 PHP-backend-8s46 collectd [1532]: write_gcm: wg_typed_value_create_from_value_t_inline 交换/百分比/值失败!继续。 Jan 26 10:23:21 PHP-backend-8s46 collectd[1532]: write_gcm: 不能取无限值 1 月 26 日 10:23:21 PHP-backend-8s46 collectd [1532]: write_gcm: wg_typed_value_create_from_value_t_inline 交换/百分比/值失败!继续。 1 月 26 日 10:23:21 PHP-backend-8s46 collectd [1532]: write_gcm: curl_easy_perform() 失败:已达到超时 1 月 26 日 10:23:21 PHP-backend-8s46 collectd [1532]:write_gcm:来自 wg_curl_get_or_post 的错误 -1 1 月 26 日 10:23:21 PHP-backend-8s46 collectd [1532]: write_gcm: wg_transmit_unique_segment 失败。 1 月 26 日 10:23:21 PHP-backend-8s46 collectd [1532]: write_gcm: wg_transmit_unique_segments 失败。冲洗。 1 月 26 日 10:23:21 PHP-backend-8s46 collectd [1532]: uc_update: Value too old: name = PHP-backend-8s46/processes-all/io_octets;价值时间 = 1611631113.168;最后一次缓存更新 = 1611631113.168; 1 月 26 日 10:23:21 PHP-backend-8s46 collectd [1532]:uc_update:值太旧:name = PHP-backend-8s46/processes-all/io_octets;价值时间 = 1611631113.167;最后一次缓存更新 = 1611631113.168; 1 月 26 日 10:23:21 PHP-backend-8s46 collectd [1532]: uc_update: 值太旧:name = PHP-backend-8s46/processes-all/ps_RSS;价值时间 = 1611631113.942;最后一次缓存更新 = 1611631113.942; 1 月 26 日 10:23:21 PHP-backend-8s46 collectd [1532]: uc_update: 值太旧:name = PHP-backend-8s46/processes-all/ps_RSS;价值时间 = 1611631113.943;上次缓存更新 = 1611631113.943; 1 月 26 日 10:23:21 PHP-backend-8s46 collectd [1532]:uc_update:值太旧:name = PHP-backend-8s46/processes-all/disk_octets;价值时间 = 1611631113.943;最后一次缓存更新 = 1611631113.944;
解决方法
这些错误表明 Google Cloud Monitoring 代理配置存在问题。
检查您是否有 Stackdriver API enabled(默认情况下未启用)。
并确保此实例的服务帐户具有写入 Stackdriver 的适当权限:
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
public class Permutation {
// iteratively compute all permutaions
private static void permute(String[] permutation,Integer[] order) {
boolean hasMore;
do {
System.out.println(Arrays.deepToString(permutation));
hasMore = next(permutation,order);
} while (hasMore);
}
// given a permutation,find the next permutation based on the order
private static boolean next(String[] permutation,Integer[] order) {
int pivot = order.length - 2;
// check from last and find the first left index greater than its next right index
while (pivot >= 0 && order[pivot + 1] < order[pivot]) {
pivot--;
}
// if reached beginning,then completed
if (pivot < 0) {
return false;
}
// find the index of least bigger element on the right
int swap = pivot + 1;
while (swap < order.length && order[pivot] < order[swap]) {
swap++;
}
swap--;
// swap pivot and its least bigger elemment
swap(order,swap,pivot);
swap(permutation,pivot);
// reverse the descending part after pivot and turn into ascending
reverse(order,pivot + 1,order.length - 1);
reverse(permutation,permutation.length - 1);
return true;
}
private static <T> void reverse(T[] a,int left,int right) {
while (left < right) {
swap(a,left++,right--);
}
}
private static <T> void swap(T[] a,int i,int j) {
T temp = a[i];
a[i] = a[j];
a[j] = temp;
}
public static void main(String[] args) {
List<String> nameList = new ArrayList<>();
nameList.add("Julia");
nameList.add("Lucas");
nameList.add("Mia");
String[] permutation = nameList.toArray(new String[nameList.size()]);
Integer[] order = IntStream.range(0,nameList.size()).boxed()
.collect(Collectors.toList()).toArray(new Integer[nameList.size()]);
permute(permutation,order);
}
}
如果您仍然看到这些错误:
gcloud projects add-iam-policy-binding PROJECT_NAME --member="serviceAccount:SERVICE_ACCOUNT_EMAIL" --role="roles/logging.logWriter"
gcloud projects add-iam-policy-binding PROJECT_NAME --member="serviceAccount:SERVICE_ACCOUNT_EMAIL" --role="roles/monitoring.metricWriter"
然后编辑 write_gcm: can not take infinite value
write_gcm: wg_typed_value_create_from_value_t_inline failed for swap/percent/value! Continuing.
并删除以下部分:
/etc/stackdriver/collectd.conf
并重新启动 Stackdriver 代理。
您还可以仔细检查您的配置是否符合这些instructions。
如果您仍然遇到错误,请尝试这些troubleshooting steps。