我已经在kubernetes v1.11.2上安装了metrics-server。
我正在使用3个节点和1个主节点运行裸机集群
在metrics-server日志中,出现以下错误:
E0907 14:29:51.774592 1 manager.go:102] unable to fully collect metrics: [unable to fully scrape metrics from source kubelet_summary:vps01: unable to
fetch metrics from Kubelet vps01 (vps01): Get https://vps01:10250/stats/summary/: dial tcp: lookup vps01 on 10.96.0.10:53: no such host, unable to fully scr
ape metrics from source kubelet_summary:vps04: unable to fetch metrics from Kubelet vps04 (vps04): Get https://vps04:10250/stats/summary/: dial tcp: lookup
vps04 on 10.96.0.10:53: no such host, unable to fully scrape metrics from source kubelet_summary:vps03: unable to fetch metrics …Run Code Online (Sandbox Code Playgroud) 我开始学习Ruby了.我读了通过引用方法传递的参数,但是我不明白这两种方法之间的区别.
def print(text)
puts text
end
Run Code Online (Sandbox Code Playgroud)
和
def print(*text)
puts text
end
Run Code Online (Sandbox Code Playgroud)
使用一种*方法,我们传递像C一样的指针?
我不明白为什么这段代码不能正常工作:
def test
raise Exception.new 'error'
end
def caller
begin
test
rescue =>e
puts e.message
end
end
caller
Run Code Online (Sandbox Code Playgroud)
我想在caller方法中捕获测试异常,但似乎该caller方法没有捕获任何东西.
我正在制作一个记录器.我想创建一个log()以流作为输入的函数.
例如:
log("hello"<<" "<<"world"<<10<<"\n");
Run Code Online (Sandbox Code Playgroud)
我也希望它是线程安全的.
我重新定义了<<运算符,所以我可以这样做:
log()<<"hello"<<"world"<<10<<"\n"
Run Code Online (Sandbox Code Playgroud)
但是这个操作不是线程安全的.
如何使其线程安全?
我正在编写一个程序,该程序将读取的数据转发给另一个对等方。我有一个方法,每次在套接字上读取数据后都会被调用。此方法将数据分条发送,以将其写回到另一个对等方。当发送大量数据时,应用程序发送回的数据与接收到的数据不同,问题在于不再对数据进行排序。只有在boost :: asio :: io_service中使用多个线程时,才会出现这种情况。
在套接字上读取某些数据时,将调用handleGatewayReply。此时(1),在将数据写入文件之后,我可以看到数据仍然是有序的。此后,将调用postBackendReply,并且数据仍然有序(2)。但是在SessionConnection :: postReply中,如果我将数据刷新到文件(3),则可以看到不再对数据进行排序。我现在看不到为什么订单丢失了,我试图在handleGatewayReply和postBackendReply中使用一个代码段(如代码所示),但是行为仍然相同。
抱歉,我无法提交一个最小,完整和可验证的示例,因为该错误太难发现,需要多线程转发大量数据。
void Reply::handleGatewayReply(std::stringstream* stream)
{
// Flush data to file (1)
m_strand.post(std::bind([=]() {
postBackendReply(*stream);
delete stream;
}
}));
}
void Reply::postBackendReply(const std::stringstream& stream)
{
auto buffer = std::make_shared<Buffer>();
buffer->m_buffers.push_back(stream.str());
// Flush data to file (2)
auto connection = m_request->connection();
if (connection) {
// connection->postReply(buffer); // doesn't work either
m_strand.post(std::bind(&SessionConnection::postReply, connection,buffer));
}
}
void SessionConnection::postReply(BufferPtr buffer)
{
// Flush data to file (3)
m_ioService.post(
m_ostrand.wrap(
std::bind(&SessionConnection::sendNext,
shared_from_this(), buffer)));
}
}
Run Code Online (Sandbox Code Playgroud) c++ ×2
ruby ×2
boost ×1
boost-asio ×1
exception ×1
kubernetes ×1
methods ×1
pointers ×1
sockets ×1
stream ×1