安装kubernetes阿里云镜像

/etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=http://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64
enabled=1
gpgcheck=0
repo_gpgcheck=0
gpgkey=http://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg
       http://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg

java后端系统架构,解决方案合集

缓存框架:

spring cache:http://spring.io/guides/gs/caching/

jetcache :https://github.com/alibaba/jetcache

redis相关 :

redisson :https://github.com/redisson/redisson

jedis :https://github.com/xetorthio/jedis

redisDesktop :https://github.com/uglide/RedisDesktopManager

cachecloud :https://github.com/sohutv/cachecloud

api文档管理:

easy-mock :https://github.com/easy-mock/easy-mock

ApiManager :https://github.com/EhsanTang/ApiManager

showdoc :https://github.com/star7th/showdoc

配置中心 :

apollo :https://github.com/ctripcorp/apollo

disconf :https://github.com/knightliao/disconf

spring cloud config

注册中心服务:

zookpeer :http://zookeeper.apache.org/

eureka :https://github.com/Netflix/eureka

consul :https://github.com/hashicorp/consul

etcd :https://github.com/coreos/etcd

rpc :

dubbo :https://github.com/apache/incubator-dubbo

motan :https://github.com/weibocom/motan

sofa-rpc :https://github.com/alipay/sofa-rpc

mqrpc :https://gitee.com/kailing/springboot-mqrpc

微服务 :

spring cloud :http://projects.spring.io/spring-cloud/

ServiceComb :http://servicecomb.incubator.apache.org/cn/

api网关 :

zuul :https://github.com/Netflix/zuul

kong :https://github.com/Kong/kong

orange :https://github.com/sumory/orange

分布式事务 :

lcn : https://github.com/codingapi/tx-lcn/

tcc-transaction :https://github.com/changmingxie/tcc-transaction

coolmq :https://github.com/vvsuperman/coolmq

Raincat :https://github.com/yu199195/Raincat

分布式锁 :

klock :https://gitee.com/kekingcn/spring-boot-klock-starter

lock-spring :https://github.com/zouyingchun/lock-spring

分布式任务调度 :

xxl-job : https://github.com/xuxueli/xxl-job

Elastic-job : https://github.com/elasticjob/elastic-job-lite

批处理 :

spring batch :https://spring.io/projects/spring-batch

partitionjob :https://gitee.com/kailing/partitionjob

NewSql :

tidb :https://github.com/pingcap/tidb

oceanbase :https://github.com/alibaba/oceanbase

数据库中间件:

cetus :https://github.com/Lede-Inc/cetus

DBProxy :https://github.com/Meituan-Dianping/DBProxy

mycat :https://github.com/MyCATApache/Mycat-Server

sharding-jdbc :https://github.com/shardingjdbc/sharding-jdbc

dble :https://github.com/actiontech/dble

proxysql :https://github.com/sysown/proxysql

数据库连接池:

druid :https://github.com/alibaba/druid

tomcatjdbc :http://tomcat.apache.org/tomcat-8.0-doc/jdbc-pool.html

HikariCP :https://github.com/brettwooldridge/HikariCP

数据访问 :

jpa : https://github.com/spring-projects/spring-data-jpa

querydsl :https://github.com/querydsl/querydsl

jooq :https://github.com/jOOQ/jOOQ

mango :https://github.com/jfaster/mango

minidao :https://gitee.com/jeecg/minidao

binlog增量日志消费:

keking-binlog :https://gitee.com/kekingcn/keking-binlog-distributor

mysql-binlog-connector-java :https://github.com/shyiko/mysql-binlog-connector-java

canal :https://github.com/alibaba/canal

puma :https://github.com/dianping/puma

open-replicator :https://github.com/whitesock/open-replicator

索引引擎:

elasticsearch :https://github.com/elastic/elasticsearch

solr :http://lucene.apache.org/solr/guide/7_3/

lucene :http://lucene.apache.org/

消息中间件:

RabbitMQ :http://www.rabbitmq.com/getstarted.html

ActiveMQ :https://github.com/apache/activemq

kafka :https://github.com/apache/kafka

rocketmq :https://github.com/apache/rocketmq

zbus :http://zbus.io/

DevOps:

jenkins :https://jenkins.io

hudson :http://www.eclipse.org/hudson

rundeck :https://github.com/rundeck/rundeck

Hygieia :https://github.com/capitalone/Hygieia

应用安全:

openrasp :https://github.com/baidu/openrasp

apm :

skywalking :https://github.com/apache/incubator-skywalking

pinpoint :https://github.com/naver/pinpoint

zipkin :https://github.com/openzipkin/zipkin

cat :https://github.com/dianping/cat

快速开发,微核心:

spring boot :http://projects.spring.io/spring-boot/

jfinal :https://gitee.com/jfinal/jfinal

nutz :https://github.com/nutzam/nutz

日志采集:

logpipe :https://github.com/calvinwilliams/logpipe

logstash :https://github.com/elastic/logstash

爬虫相关:

webmagic :https://gitee.com/flashsword20/webmagic

WebCollector :https://github.com/CrawlScript/WebCollector

jsoup :https://github.com/jhy/jsoup

感觉蚂蚁金服的RPC框架 sofa-rpc 跟好多年前EJB调用一模一样啊

看到蚂蚁金服的RPC框架 sofa-rpc 调用Demo : https://github.com/alipay/sofa-rpc/wiki/Getting-Started-With-RPC  ,感觉跟多年前EJB调用方式一模一样啊

其它RPC 例如Dubbo也没用过,一直用Spring Cloud,蚂蚁金服的RPC调用性能远超Google的lstio,真的是这样吗?

再看扩展点https://github.com/alipay/sofa-rpc/wiki/Extension-Loader

感觉是Ecplise 插件机制的框架应用在了RPC

所以感觉蚂蚁金服的RPC框架是在Spring Boot基础之上,借鉴了EJB Remote Call机制和Ecplise插件扩展机制,看其致谢:SOFARPC 最早源于阿里内部的 HSF,非常感谢毕玄创造了 HSF,使 SOFARPC 的发展有了良好的基础,也非常感谢寒泉子,独明,世范在 SOFARPC 发展过程中作出的贡献。毕玄、寒泉子,独明出身于IBM ?

关于Mybatis从几百万条记录返回7万条记录,并在tomcat显示问题

1)由于客户字段并不统一,随时有可能变化,是由Excel上传动态解析Excel形成的一个动态表,所以Mybatis返回,resultType并不是一个具体的Bean ,而是一个List<Map>

<select id=”find” resultType=”java.util.HashMap”
parameterType=”java.util.HashMap”>
${sql}
</select>

数据量小的时候,还不明显,数据量一大,数万条记录,就要了 老命了,用List<Map>解决动态字段的问题,在大数据下 是很不实用的,所以我直接用了JDBC的ResultSet,并用流式打开PreparedStatement

SqlSession session = sqlSessionFactory.openSession();
// List ll=session.selectList(“query”,TableObject.class);
JSONArray vos = new JSONArray();
Connection conn = null;
try {
conn = session.getConfiguration().getEnvironment().getDataSource().getConnection();
PreparedStatement stmt = conn.prepareStatement(sql, ResultSet.TYPE_FORWARD_ONLY,
ResultSet.CONCUR_READ_ONLY);
stmt.setFetchSize(Integer.MIN_VALUE);
ResultSet rs = stmt.executeQuery();
ResultSetMetaData rsmd = rs.getMetaData();
int columnCount = rsmd.getColumnCount();

try {
while (rs.next()) {
JSONObject vo = new JSONObject();
for (int i = 1; i <= columnCount; i++) {
String key = rsmd.getColumnName(i);
String value = rs.getString(i);
vo.put(key, value);
}
vos.add(vo);
}
} catch (Exception e) {
e.printStackTrace();
}

rs.close();
stmt.close();
// conn.close();
} catch (Exception e) {
e.printStackTrace();
}

session.close();

时间立即由几十秒 缩短为 几秒或者10几秒

2) 数据量返回太大,tomcat假死

tomcat的server.xml修改为:

<Connector port=”8080″ protocol=”HTTP/1.1″
connectionTimeout=”20000″
compression=”on”
compressionMinSize1=”2048″
noCompressionUserAgents=”gozilla, traviata”
compressableMimeType=”text/html,text/xml,text/javascript,text/css,text/plain”
redirectPort=”8443″ />

即启用tomcat压缩形式,tomcat响应立即 由一分钟以上 缩短为几秒。

 

 

Spring MVC/Boot的精义其实还是@Autowired、Context上下文

Context上下文 其实是一个很古老的概念,打从有Web 容器这个概念。例如Tomcat、WebSphere、Weblogic就有Context上下文这个概念,从最初的JNDI、到EJB,以及Spring MVC倡导的bean注入,无以不体现着 Context上下文的理念在里面

Spring Boot把嵌入式容器和Context上下文弄的依赖外部项少了,发布的成本像比较于EJB,发布成本大大降低了,但还是离不开Context上下文不是,否则@Autowired标签就没有任何意义了。

相比较于Spring boot以及Tomcat的Context、Look up Bean的成本在编译和运行时,容器替你做了一部分工作,分担了look up的成本,但是React的state就比较恶心了,React的组件里面有子组件时,需要通过state交换参数,就没有Context上下文的概念了。

也许是我对前端其实不不太熟悉的缘故吧。

 

4月10号左右,离开了联想的项目组,已经有一个多月了,这一个月来,朋友介绍了一个传统零售企业BI报表的项目,做的我累死了,每天比在联想还累,但是还没签合同,客户也没说付款,哎。

40多岁的老男人,再就业其实真不容易啊。:)

 

这个照片是今天中午在合生会吃饭拍的。不上班,在家附近的庆丰公园溜达,在合生汇溜达,感觉人生还是很美好的。

 

 

关于React 的文件上传

接触React的时间并不长,所以有些坑还是浪费了很多时间的,比如基于React的文件上传。React 支持input type=file ,所以React 当然也支持任何文件上传,不过怎么获得input type=file的值?网上并没有怎么深入地讲,更多讲的是基于什么组件的文件上传,不过这些组件都是跟React以及相关周边组件的版本密切相关,在github.com上搜索了接,均不能用,没办法,百度、谷歌了很久,耽误了两天的时间,终于找到了最简单的React文件上传的办法。核心代码如下:

onstructor(props) {
super(props);
this.uploadexcel = this.uploadexcel.bind(this);
this.state = {
tablename:””,
visible: false,
isUpdate: false,
loading: true,
columns:[],
fieldslayout:[],
};
}
uploadtarget(value){
targeturl=value;
};

uploadexcel = (selectorFiles: FileList) => {
console.log(selectorFiles);
var file1=selectorFiles[0];
let formData = new FormData();
formData.append(“file”, file1);
let access_token=localStorage.getItem(“access_token”);
let catalog=localStorage.getItem(“catalog”);
var remoteurl=request.getRemoteURL()+”/”+catalog+”/excel/upload/”+targeturl;

fetch(remoteurl, {
method: ‘POST’,
mode: ‘cors’,
headers: {
‘Authorization’:access_token
},
body: formData,
}).then(function(response){
if(response.ok) {
response.json().then(function(obj) {
let code=obj.code;
if(code==200){
alert(“Excel数据上传成功!”);
queryData(this);
}else{
alert(“Excel数据上传失败!”);
}
})
}else{
alert(“Excel数据上传失败!!!”);
}
}).catch(function (error) {
alert(“后端数据服务连接异常,保存失败!”);
});

}

render(){
const { visible, isUpdate, loading} = this.state;

if(this.state.tablename==null&&this.props.match.params.tablename!=null
||this.state.tablename!=null&&this.props.match.params.tablename!=this.state.tablename){
this.state.tablename=this.props.match.params.tablename;
queryFields(this);
}

return(
<div>
<BreadcrumbCustom paths={[‘首页’,’表单’]}/>
<div className=’formBody’ ref=”mainBody”>
<form ref=”uploadForm” encType=”multipart/form-data”>
<Row gutter={24}>
<div class=’btnOpera’>
<Select defaultValue=”01″ style={{ width: 150 }} >
<Option value=”01″>分销商</Option>
<Option value=”02″>直营</Option>
</Select>
<Select defaultValue=”feixiandfgwgc” style={{ width: 220 }} onChange={this.uploadtarget}>
<Option value=”feixiandfgwgc”>家乐福</Option>
<Option value=”guohuoxtmjrr”>沃尔玛</Option>
<Option value=”likelai”>百万庄园</Option>
<Option value=”tongyi”>统一</Option>
</Select>
<input ref=”file” type=”file” name=”file” onChange={ (e) => this.uploadexcel(e.target.files) }/>
<Button type=”primary” onClick={this.btnSearch_Click} >查询</Button>
</div>

</Row>
</form>
<FormTable
columns={this.state.columns}
dataSource={this.state.dataSource}
/>

</div>
</div>
)
}
}

 

 

react导出Excel表

.then(response => response.blob())
        .then(blob => {
            var url = window.URL.createObjectURL(blob);
            var a = document.createElement('a');
            a.href = url;
            a.download = "filename.xlsx";
            a.click();                    
        });