java.lang.NoClassDefFoundError: Could Not Initialize Class com.dianping.cat.message.internal.DefaultMessageProducer

在使用的时候程序中经常会报如下错误:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
[WARN][2020-09-27 11:41:24:908][][][nioEventLoopGroup-3-6][io.netty.channel.DefaultChannelPipeline][1152]- An exceptionCaught() event was fired, and it reached at the tail of the pipeline. It usually means the last handler in the pipeline did not handle the exception.
java.lang.NoClassDefFoundError: Could not initialize class com.dianping.cat.message.internal.DefaultMessageProducer
at com.dianping.cat.Cat.initializeInternal(Cat.java:311)
at com.dianping.cat.Cat.checkAndInitialize(Cat.java:72)
at com.dianping.cat.Cat.getProducer(Cat.java:211)
at com.sample.logserver.handler.ActionHandler.channelRead0(ActionHandler.java:38)
at com.sample.logserver.handler.ActionHandler.channelRead0(ActionHandler.java:32)
at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:99)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:436)
at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:321)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:295)
at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:251)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:714)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:650)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:576)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:745)

CAT日志文件/data/appdatas/cat/cat_client_20200927.log中的错误

Read More

Python3环境安装

本来想写一个Python3环境安装的笔记,以备自己以后使用,但是我发现网上有些文章写的已经很好了,我就不再赘述了。链接如下:
https://liqiang.io/post/install-python3-8-in-centos-973bdb81

下载python3

下载的是 Python3.8 版本的:Python-3.8.0.tgz
[root@test]# wget https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tgz -O /tmp/Python-3.8.0.tgz
[root@test]# cd /tmp && tar zxf Python-3.8.0.tgz
[root@test]# cd Python-3.8.0

编译安装 Python3.8

1
2
3
4
5
[root@test]# rm -rf /usr/local/python3 #如果之前安装过Python3,最好将其卸载掉。
[root@test]# yum install sqlite-devel #安装sqlite,非常多的框架都依赖这个数据库,如果不安装,很有可能之后还得重新安装Python
[root@test]# ./configure prefix=/usr/local/python3
[root@test]# make && make install
[root@test]# export PATH=$PATH:/usr/local/python3/bin/

问题1

python 3.8.0 编译报错 SystemError: returned NULL without setting an error。

解决方式

configure的时候将--enable-optimizations去掉
参考 https://stackoverflow.com/questions/58048079/how-to-succesfully-compile-python-3-7

Yikes! KeeperErrorCode = Unimplemented for /Kafka-Manager/mutex Try Again

Yikes! KeeperErrorCode = Unimplemented for /kafka-manager/mutex Try again

CMAK添加集群的时候报错,Yikes! KeeperErrorCode = Unimplemented for /kafka-manager/mutex Try again

参考网址 https://github.com/yahoo/CMAK/issues/731

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
my docker image version
zookeeper:3.4.14
wurstmeister/kafka:2.12-2.4.1
kafkamanager/kafka-manager:3.0.0.4
this worked for me
➜ docker exec -it zookeeper bash
root@98747a9eac65:/zookeeper-3.4.14# ./bin/zkCli.sh
[zk: localhost:2181(CONNECTED) 2] ls /kafka-manager
[configs, deleteClusters, clusters]
[zk: localhost:2181(CONNECTED) 3] create /kafka-manager/mutex ""
Created /kafka-manager/mutex
[zk: localhost:2181(CONNECTED) 5] create /kafka-manager/mutex/locks ""
Created /kafka-manager/mutex/locks
[zk: localhost:2181(CONNECTED) 6] create /kafka-manager/mutex/leases ""
Created /kafka-manager/mutex/leases

Cloudera Manager自定义报警脚本

1. python报警脚本/data/tmp/alert.py

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import requests
import sys
import json

configuraion_file="/data/apps/public/conf.ini"

def getConfig():
print(configuraion_file)
import configparser
config = configparser.ConfigParser()
config.read(configuraion_file)
return config

def eweixin_send_text(message,token=None,mobiles=[],is_at_all=False):
if not token:
config = getConfig()
token = config.get("dingding", "token")
data = json.dumps({"msgtype": "text", "text": {"content": message, "mentioned_mobile_list": mobiles}})
requests.post("https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key="+token, data, auth=('Content-Type', 'application/json'))

if __name__ == "__main__":
print("1")
myfile = sys.stdin
print("2")
data = json.load(myfile)
print("3")
for i in range(0, len(data)):
alert = data[i]["body"]["alert"]
alert_summary = alert["attributes"]["ALERT_SUMMARY"]
alert_content = alert["content"]
eweixin_send_text("alert summary: %s ,content: %s"%(alert_summary,alert_content))

2. /data/tmp/alert.sh

1
2
3
4
5
6
7
#!/usr/bin/env bash
echo $(date) >> /data/tmp/alert.log
echo $1 >>/data/tmp/peace/alert.log
echo "begin"
temp_content=`cat $1 | python3 /data/tmp/peace/alert.py`
content=`cat $1`
echo $content >>/data/tmp/alert.log

在cloudera manager中配置

Elasticsearch入门

Elasticsearch 天生就是分布式的。 Elasticsearch 在分布式方面几乎是透明的。

可以水平扩容 ,或横向扩容。

当一个节点被选举成为 主 节点时, 它将负责管理集群范围内的所有变更,例如增加、删除索引,或者增加、删除节点等。 而主节点并不需要涉及到文档级别的变更和搜索等操作,所以当集群只拥有一个主节点的情况下,即使流量的增加它也不会成为瓶颈。

作为用户,我们可以将请求发送到 集群中的任何节点 ,包括主节点。 每个节点都知道任意文档所处的位置,并且能够将我们的请求直接转发到存储我们所需文档的节点。 无论我们将请求发送到哪个节点,它都能负责从各个包含我们所需文档的节点收集回数据,并将最终结果返回給客户端。

查看节点健康状况

status 字段指示着当前集群在总体上是否工作正常。它的三种颜色含义如下:green所有的主分片和副本分片都正常运行。yellow所有的主分片都正常运行,但不是所有的副本分片都正常运行。red有主分片没能正常运行。

1
GET /_cluster/health

索引,分区,节点

Read More

公司和家里电脑共用堡垒机Pem文件

问题:发现在公司和家里不能共用一个pem文件,家里的电脑可以用的时候,公司就无法免密码登录,反之亦然。

运行 ssh-add 把键值添加的 ssh-agent 代理中,就可以了。

步骤如下:
1 启动ssh-agent

1
ssh-agent bash

2 然后运行 ssh-add 把键值添加的 ssh-agent 代理中

1
ssh-add ~/.ssh/id_rsa

参考:
https://yijiebuyi.com/blog/4b5c272e7058cb331098250c8e98eb3e.html
https://help.github.com/cn/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent