File tree Expand file tree Collapse file tree 10 files changed +914
-11
lines changed
java/com/myblog/datasource Expand file tree Collapse file tree 10 files changed +914
-11
lines changed Original file line number Diff line number Diff line change
1
+ # Created by .ignore support plugin (hsz.mobi)
2
+ # ## Java template
3
+ # Compiled class file
4
+ * .class
5
+
6
+ # Log file
7
+ * .log
8
+
9
+ # BlueJ files
10
+ * .ctxt
11
+
12
+ # Mobile Tools for Java (J2ME)
13
+ .mtj.tmp /
14
+
15
+ # Package Files #
16
+ * .jar
17
+ * .war
18
+ * .ear
19
+ * .zip
20
+ * .tar.gz
21
+ * .rar
22
+
23
+ # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
24
+ hs_err_pid *
25
+
Original file line number Diff line number Diff line change
1
+ # 2017-09-23
2
+ 服务器被黑,进程占用率高达99%,查看了一下,是/usr/sbin/bashd的原因,怎么删也删不掉,使用ps查看:
3
+ ![ ] ( http://ohlrxdl4p.bkt.clouddn.com/images/553ac1ca20170923033013.png )
4
+ stratum+tcp://get.bi-chi.com:3333 -u 47EAoaBc5TWDZKVaAYvQ7Y4ZfoJMFathAR882gabJ43wHEfxEp81vfJ3J3j6FQGJxJNQTAwvmJYS2Ei8dbkKcwfPFst8FhG
5
+
6
+ 使用top查看:
7
+ ![ ] ( http://ohlrxdl4p.bkt.clouddn.com/images/20170923033252.png )
8
+
9
+ <div align =" center " >
10
+
11
+ ![ ] ( http://ohlrxdl4p.bkt.clouddn.com/images/20170923034427.png )
12
+
13
+ </div >
14
+
15
+ <div align =" center " >
16
+
17
+ ![ ] ( http://ohlrxdl4p.bkt.clouddn.com/images/20170923040503.png )
18
+
19
+ </div >
20
+
21
+ 启动iptables,参考[ http://www.setphp.com/981.html ] ( http://www.setphp.com/981.html )
22
+ [ http://www.setphp.com/981.html ] ( http://www.setphp.com/981.html )
23
+
24
+ iptables -A INPUT -s xmr.crypto-pool.fr -j DROP
25
+ iptables -A OUTPUT -d xmr.crypto-pool.fr -j DROP
26
+
27
+
28
+
Original file line number Diff line number Diff line change
1
+ package com .myblog .datasource ;
2
+
3
+ import org .springframework .jdbc .datasource .lookup .AbstractRoutingDataSource ;
4
+
5
+ /**
6
+ * Created with IntelliJ IDEA.
7
+ * User: Zephery
8
+ * Time: 2017/9/23 12:00
9
+ * Description:
10
+ */
11
+ public class DynamicDataSource extends AbstractRoutingDataSource {
12
+
13
+ @ Override
14
+ protected Object determineCurrentLookupKey () {
15
+ // 从自定义的位置获取数据源标识
16
+ return DynamicDataSourceHolder .getDataSource ();
17
+ }
18
+
19
+ }
Original file line number Diff line number Diff line change
1
+ package com .myblog .datasource ;
2
+
3
+ /**
4
+ * Created with IntelliJ IDEA.
5
+ * User: Zephery
6
+ * Time: 2017/9/23 12:00
7
+ * Description:
8
+ */
9
+ public class DynamicDataSourceHolder {
10
+ /**
11
+ * 注意:数据源标识保存在线程变量中,避免多线程操作数据源时互相干扰
12
+ */
13
+ private static final ThreadLocal <String > THREAD_DATA_SOURCE = new ThreadLocal <String >();
14
+
15
+ public static String getDataSource () {
16
+ return THREAD_DATA_SOURCE .get ();
17
+ }
18
+
19
+ public static void setDataSource (String dataSource ) {
20
+ THREAD_DATA_SOURCE .set (dataSource );
21
+ }
22
+
23
+ public static void clearDataSource () {
24
+ THREAD_DATA_SOURCE .remove ();
25
+ }
26
+
27
+ }
Original file line number Diff line number Diff line change 30
30
</bean >
31
31
<!-- 配置数据源,使用阿里巴巴连接池Druid -->
32
32
<bean id =" dataSource" class =" com.alibaba.druid.pool.DruidDataSource" init-method =" init" destroy-method =" close" >
33
- <property name =" url" value =" ${jdbc.url }" />
34
- <property name =" username" value =" ${jdbc.username }" />
35
- <property name =" password" value =" ${jdbc.password }" />
33
+ <property name =" url" value =" ${jdbc.url_2 }" />
34
+ <property name =" username" value =" ${jdbc.username_2 }" />
35
+ <property name =" password" value =" ${jdbc.password_2 }" />
36
36
<!-- 配置这些才能使用druid监控-->
37
37
<!-- 配置初始化大小、最小、最大 -->
38
38
<property name =" initialSize" value =" 1" />
Original file line number Diff line number Diff line change 1
1
# mysql
2
2
jdbc.driverClassName =com.mysql.jdbc.Driver
3
- jdbc.url =jdbc:mysql://47.95.10.139:3306/myblog?useUnicode=true&characterEncoding=UTF-8
4
- jdbc.host =47.95.10.139
5
- jdbc.username =root
6
- jdbc.password =helloroot
7
- jdbc.database =myblog
3
+ # jdbc1
4
+ jdbc.url_1 =jdbc:mysql://47.95.10.139:3306/myblog?useUnicode=true&characterEncoding=UTF-8
5
+ jdbc.host_1 =47.95.10.139
6
+ jdbc.username_1 =root
7
+ jdbc.password_1 =helloroot
8
+ jdbc.database_1 =myblog
9
+
10
+ # jdbc2
11
+ jdbc.url_2 =jdbc:mysql://119.23.46.71:3306/myblog?useUnicode=true&characterEncoding=UTF-8
12
+ jdbc.host_2 =119.23.46.71
13
+ jdbc.username_2 =root
14
+ jdbc.password_2 =helloroot
15
+ jdbc.database_2 =myblog
16
+
8
17
# server
9
18
# remember to update or change
10
- server.host =47.95.10.139
19
+ server.host =119.23.46.71
11
20
server.username =wenzhihuai
12
21
server.password =wenzhihuai
13
22
# redis
14
- host =47.95.10.139
23
+ host =119.23.46.71
15
24
port =6379
16
25
password =root
17
26
timeout =5000
18
27
maxIdle =8
19
28
minIdle =0
20
29
maxWait =8
21
30
# Jmx
22
- jmx_ip =47.95.10.139
31
+ jmx_ip =119.23.46.71
23
32
jmx_port =8888
24
33
credentials =monitorRole,tomcat
25
34
# 设置最大连接数
You can’t perform that action at this time.
0 commit comments