Linux-socket内核参数配置及含义详解

星期一, 2020-06-08 | Author: Lee | JAVA-and-J2EE, linux | 没有评论 3,314 views

多由于Linux下解决time_wait连接过多(Linux内核优化配置)

内核文件配置:

vi /etc/sysctl.conf
##生效
/sbin/sysctl -p
 
##查看keepalive的相关配置
sysctl -a | grep keepalive
 
##查看tcp连接的相关状态指令
netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}'
 
##若没有netstat指令安装
yum install net-tools

内核配置注释信息,参考自己的内存和CPU核数进行优化配置,如下
› 继续阅读

Tags: ,

centos查询大于100M文件命令

星期三, 2020-06-03 | Author: Lee | JAVA-and-J2EE, linux | 没有评论 1,914 views

centos 查询大于100M文件及列出

ls -lh $(find / -type f -size +100M)

spring boot aop log拦截配置

星期一, 2020-05-25 | Author: Lee | JAVA-and-J2EE | 没有评论 1,941 views

要记录web的入参和出参及方法执行情况,执行如下配置即可

package com.pomelolee.configuration;
 
import lombok.extern.slf4j.Slf4j;
 
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
 
import org.apache.commons.lang3.StringUtils;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.stereotype.Component;
import org.springframework.util.StopWatch;
import org.springframework.web.multipart.MultipartFile;
 
@Slf4j
@Aspect
@Component
public class WebControllerLogConfig {
 
    @Pointcut("execution(public * com.pomelolee.endpoint.*.*(..))")
    public void webRecordLog() {
 
    }
 
    @Around("webRecordLog()")
    public Object process(ProceedingJoinPoint jp) throws Throwable {
        String className = jp.getSignature().getDeclaringTypeName();
        String methodName = ((MethodSignature) jp.getSignature()).getMethod().getName();
        String classMethod = className + "." + methodName;
        Object[] arguments = jp.getArgs();
        Object[] args = new Object[arguments.length];
        for(int i=0;i<arguments.length;i++) {
    	 if (arguments[i] instanceof ServletRequest || arguments[i] instanceof ServletResponse || arguments[i] instanceof MultipartFile) { 
             //ServletRequest不能序列化,从入参里排除,否则报异常:java.lang.IllegalStateException: It is illegal to call this method if the current request is not in asynchronous mode (i.e. isAsyncStarted() returns false)
             //ServletResponse不能序列化 从入参里排除,否则报异常:java.lang.IllegalStateException: getOutputStream() has already been called for this response
               continue;
           }
           args[i] = arguments[i];
        }
        log.info("===controller classMethod:{},input args:{} ====", classMethod, JsonKit.toJSONString(args));
        final StopWatch stopWatch = new StopWatch();
        stopWatch.start();
        Object result = jp.proceed();
        stopWatch.stop();
        final String logMessage = StringUtils.leftPad(Long.toString(stopWatch.getTotalTimeMillis()), 5) + " ms ";
        log.info("the classMethod: {} cost time: {}",classMethod,logMessage);
        log.info("===controller  classMethod: {} ,input args:{} ====", classMethod, JsonKit.toJSONString(result));
        return result;
    }
}

比较完整,排除了 out等输出的异常情况

Tags: ,

VirtualBox下centos7修复generating /run/initramfs/rdsosreport.txt无法启动问题

星期二, 2020-04-28 | Author: Lee | computer, linux | 没有评论 4,648 views

开机就进入命令窗口,窗口提示信息如下,无法进入系统,让人头大:

generating “/run/initramfs/rdsosreport.txt”
entering emergencymode. exit the shell to continue
type “journalctl” to view system logs.
you might want to save “/run/initramfs/rdsosreport.txt” to a usb stick or /boot after mounting them and attach it to a bug report。

解决办法的命令如下:

xfs_repair /dev/mapper/centos-root -L
reboot

Tags: ,

springboot的关闭eureka注册中心服务

星期日, 2020-04-26 | Author: Lee | JAVA-and-J2EE | 没有评论 6,019 views

1.本地调试的时候不希望注册到eureka上影响其他服务的调用

可以配置applicatioon.properties文件添加对应的配置即可

eureka.client.register-with-eureka=false
eureka.client.fetchRegistry=false
eureka.client.server.waitTimeInMsWhenSyncEmpty=0

启动应用服务,可以到对应的注册中心(http://localhost:8761/eureka)查看,没有注册上来,ok

Tags: , ,

大数据相关的资料信息整理篇

星期一, 2020-04-13 | Author: Lee | 大数据 | 没有评论 1,709 views

1.大数据相关的资料信息 需要了解和掌握的东西记录下

1.大数据技术知识

第一章:基础组件篇

分布式协调系统:ZooKeeper

大数据基础平台:Hadoop

第二章:数据采集篇

分布式日志采集系统:Flume、Canal

分布式导入数据系统:Sqoop

第三章:数据存储篇

分布式数据仓库:Hive

分布式列式数据库:HBase

分布式消息系统:Kafka

分布式列式存储系统:Kudu

第四章:数据处理篇

快速通用的分布式计算引擎:Spark

新一代的分布式计算引擎:Flink

第五章:调度篇

分布式调度系统:Azkaban

第六章:OLAP篇

分布式内存实时分析系统:Druid

实时多维分析系统:Kylin

› 继续阅读

Tags:

fastjson < 1.2.67 反序列化远程代码执行漏洞升级及思考

星期三, 2020-03-25 | Author: Lee | JAVA-and-J2EE | 没有评论 3,273 views

阿里云推送了fastjson 安全提醒,记得上次升级到61版本还没有多久,这次又有0day漏洞,其实对很多应用基本上是没有影响的,不用管它就行.

只是有短信 邮件等提醒 还是让人心不安的,从墨菲定律的上面说,你不知道其他人是怎么使用的就有可能会中招,从公司角度就是督促升级或者移除fastjson依赖、

或者购买安全服务拦截.

一:准备移除fastjson的依赖了,看了下封装个工具类JsonKit,实现下面的几个方法,就可以很好的替换了,更多功能根据自己的实际应用处理.

据华为云披露升级到1.2.67也无法完全避免,还有部分没有完全添加到黑名单中,默认关闭type即可.

public static String toJSONString(Object data) {
		try {
			return mapper.writeValueAsString(data);
		} catch (JsonProcessingException e) {
			e.printStackTrace();
		}
		return "";
	}
 
	public static String parseObjectVal(String data, String key) {
		try {
			JsonNode node = mapper.readTree(data);
			return node.get(key).toString();
		} catch (IOException e) {
			e.printStackTrace();
		}
		return null;
	}
 
	public static <t> T parseArray(String data, TypeReference</t><t> valueTypeRef) {
		T ret = null;
		try {
			ret = mapper.readValue(data, valueTypeRef);
		} catch (JsonParseException e) {
			e.printStackTrace();
		} catch (JsonMappingException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
		return ret;
	}
 
	public static Map<String, Object> parseObject(String data) {
		Map<String, Object> map = parseObject(data, new TypeReference<Map<String, Object>>() {
		});
		return map;
	}
 
       // ......
</t>

› 继续阅读

Tags: ,

tomcat9配置优化及使用jdk11的调整

星期四, 2020-03-12 | Author: Lee | JAVA-and-J2EE | 没有评论 5,686 views

把常用调整的部分整理记录了下,方便自己以后翻阅和调整

本人实际tomcat9应用中,只注释了conf/server.xml下ajp的服务,新增了bin下的setenv.sh 的JVM配置及spring外置的配置文件

那些调整数值的根据自行配置调整.

1.系统启用nginx+tomcat配合

2.本文主要优化tomcat的配置项目

配置项参考:http://tomcat.apache.org/tomcat-9.0-doc/config/http.html

2.1 关闭AJP端口及war包的热部署
› 继续阅读

Tags: , , ,

网站监控功能上线

星期日, 2020-03-01 | Author: Lee | JAVA-and-J2EE | 没有评论 1,491 views

监控网站是否运行正常一直是个问题,终于花了2天时间,开发了此后台功能.

1.实行指定页面的访问监控系统的运行状况

功能包括:

1.1 每10分钟扫描一次待验证的站点,每个站点的间隔时间支持自定义,以10分钟为基本刻度

1.2 记录每次扫描站点的信息,供后续出问题及时排查也留档当时的一些情况.

1.3 返回系统异常时候 此处打通钉钉的群通知进行手机提醒,虽说很讨厌钉钉的夺命连环CALL功能,但能免费提醒还是不

错的,接入微信的通知比较麻烦,接手机短信的还要收费等,一系列下来感觉还是钉钉比较方便,有更好的,再接入

其他通知即可, 接口开放很方便.

2.查看扫描信息、添加、修改监控站点信息钉钉通知渠道,间隔通知时间,关闭检测 常用的功能,

后续只要添加需要监控的网站即可

3.目前只是监控自己旗下网站是否可以正常访问,发现异常好及时处理

4.拓展功能,后续开放给用户,或者监控指定网站的异动及更新等

Tags:

PHP7.2 下mcrypt_module_open() 无法使用的解决方法

星期五, 2020-02-28 | Author: Lee | php | 没有评论 3,587 views

php版本升级到7.2后,其他看下来没有什么问题,在小程序的授权上,出现了错误,无法找到mcrypt_module_open的函数.

查询网上方法修复之.

主要是使用 openssl_decrypt来替换解决,解密协议为AES-128-CBC,

如果无法解析可以尝试AES-256-CBC,本人使用AES-128-CBC正常解析的

微信那边解密错误会返回错误码-41003,则解析错误.

1.修改文件wxBizDataCrypt.php
› 继续阅读

Tags: ,

Search

文章分类

Links

Meta