Java ORM

@ManyToOne

1
2
3
fetch = FetchType.LAZY
cascade = CascadeType.ALL
optional = false

@OneToOne

1
2
3
4
fetch = FetchType.LAZY
cascade = CascadeType.ALL
mappedBy = "XXX"
orphanRemoval = true

@NotFound

修改NotFound默认为NotFoundAction.IGNORE

1
2
3
4
5
AnnotationBinder.java

boolean ignoreNotFound = notFound != null && notFound.action().equals( NotFoundAction.IGNORE );
改为
boolean ignoreNotFound = notFound == null;

Linux Troubleshoot

here were XXX failed login attempts since the last successful login.

Too Many Open Files

vi /etc/sysctl.conf

1
2
3
4
5
6
net.ipv4.tcp_keepalive_time = 1800
net.ipv4.tcp_keepalive_probes = 3
net.ipv4.tcp_keepalive_intvl = 15

net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1

sysctl -p

时间不准确

通过ntp同步时间

  • 需要安装 yum install -y ntp
  • 启动 systemctl enable ntpd
  • 更新时间 ntpdate -u ntp1.aliyun.com

直接修改

1
timedatectl set-time "2022-06-10 18:34:00"

Apache ZooKeeper

安装

1
2
3
4
5
6
7
cd ~/download
wget zookeeper-3.4.6.tar.gz
mkdir /usr/local/zookeeper && cd /usr/local/zookeeper/
tar xzvf ~/download/zookeeper-3.4.6.tar.gz

cd zookeeper-3.4.6/conf
cp zoo_sample.cfg zoo.cfg

启动

1
2
cd ..
bin/zkServer.sh start

Apache ActiveMQ

概念

Queues

Messages

Consumers

Messages Enqueued | Messages Dequeued

Purge

安装

1
2
3
4
5
cd ~/download
wget activemq-5.15.12-bin.tar.gz
mkdir /usr/local/activemq && cd /usr/local/activemq
tar xzvf ~/download/activemq-5.15.12-bin.tar.gz
mv apache-activemq-5.15.12/ activemq5.15

启动

1
2
cd activemq5.15/bin
./activemq start && tail -f data/activemq.log

停止

1
./activemq stop

配置

编辑 conf\activemq.xml

1
transportConnectors

读写

1
2
3
./activemq producer --message "Mymessage" --messageCount 1
./activemq producer --messageSize 100 --messageCount 1
./activemq producer --payloadUrl http://activemq.apache.org/schema/core/activemq-core.xsd --messageCount 1
1
2
3
./activemq consumer --transacted true
./activemq consumer --ackMode CLIENT_ACKNOWLEDGE
./activemq consumer --durable true --clientId example --destination topic://TEST

常用命令

1
2
activemq status
activemq dstat

参考