以linkedme用户的权限进行操作
sudo su linkedme
创建/删除用户
useradd viuman
userdel viuman
为用户设置密码
passwd viuman
切换用户
su - viuman
添加sudoers,下次该命令前加sudo就能以root权限执行
p.p1 { margin: 0; font: 11px Menlo; color: rgba(0, 0, 0, 1) }
span.s1 { font-variant-ligatures: no-common-ligatures }
[viuman@iZ2ze3gpxv4kgzv47hocmoZ ~]$ visudo
p.p1 { margin: 0; font: 11px Menlo; color: rgba(0, 0, 0, 1) }
span.s1 { font-variant-ligatures: no-common-ligatures }
## Allow root to run any commands anywhere
root ALL=(ALL) ALL
viuman ALL=(ALL) ALL
## 不用输密码
bofeng ALL=(ALL) NOPASSWD: ALL
修改文件或目录的所有者为viuman
chown -R viuman /home/viuman/*
打成war包。生成在工程的target目录下
mvn clean install -Dmaven.test.skip=true -P dev
git删除远程仓库分支
git push origin --delete temp_dev
git从指定分支克隆
git clone -b dev git@github.com:bofeng023/viuman-microservice.git
git直接切换到远程分支
git checkout -b dev origin/dev
jackson操作json
1)import com.fasterxml.jackson.databind.ObjectMapper;
2)json转对象
genericSpecs = mapper.readValue(spuDetail.getSpecifications(),new TypeReference<List<Map<String,Object>>>(){});
3)对象转json
String skus = mapper.writeValueAsString(skuList);
lambda集合转map
Map<String, MerchCategory> map = catList.stream().collect(Collectors.toMap(MerchCategory::getId,Function.identity()));
手机配burpsuite代理
1)burp代理地址设置为ip地址加端口号。不能是127.0.0.1
2)burp的intercept设置为off
3)手机wifi设置代理为手动,输入ip和端口
4)手机访问http://burp,安装证书
jenkins配置服务器和war上传路径:
主界面=>左侧菜单栏系统管理=>系统设置
jenkins配置凭据:
主界面=>左侧菜单栏凭据
报错ClientAbortException: java.io.IOException: Broken pipe
解决:修改网关微服务application.yml
ribbon:
ConnectTimeout: 250 # 连接超时时间(ms)
ReadTimeout: 2000 # 通信超时时间(ms)
OkToRetryOnAllOperations: true # 是否对所有操作重试
MaxAutoRetriesNextServer: 1 # 同一服务不同实例的重试次数
MaxAutoRetries: 1 # 同一实例的重试次数
报错 Failed to auto-configure a DataSource: ‘spring.datasource.url’ is not specified and no embedded datasource could be auto-configured.
解决:
spring:
autoconfigure:
exclude: org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
报错:AMQP protocol version mismatch; we are version 0-9-1, server sent signature 3,1,0,0
application.yml没配置rabbitmq
ssl证书设置:https://help.aliyun.com/document_detail/102427.html?spm=5176.13910061.0.0.337835e6L943JC&aly_as=u6gIi3oUV
https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=10_4
远程调试:
在catalina.sh里配置:
CATALINA_OPTS=”-XX:+PrintGC -Xloggc:../logs/tomcat_gc.log -agentlib:jdwp=transport=dt_socket,server=y,address=8999,suspend=n”
解决idea terminal中文乱码
1)修改idea64.exe.vmoptions文件,在其最后一行添加
-Dfile.encoding=UTF-8
2)修改git安装路径下的bash.bashrc文件,在文件最后添加
export LANG="zh_CN.UTF-8"
export LC_ALL="zh_CN.UTF-8"