Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

YANGLiiN yangl

🎯
Focusing
  • JD.com
  • Shenzhen, Guangdong, China
Block or report user

Report or block yangl

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@yangl
yangl / kafka_no_message_lose_order.md
Last active Aug 29, 2019
Kafka保证有序且不丢失配置
View kafka_no_message_lose_order.md

不开启事务 情况下

Producer

block.on.buffer.full=true
retries=Integer.MAX_VALUE
acks=all
max.in.flight.requests.per.connection=1
View jvm dns cache.md
// 设置DNS缓存时长: 秒
Security.setProperty("networkaddress.cache.ttl", "10");
Security.setProperty("networkaddress.cache.negative.ttl", "3");
@yangl
yangl / frontend-maven-plugin.xml
Created Aug 19, 2019
项目内自定义Node.js版本
View frontend-maven-plugin.xml
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>1.8.0</version>
<configuration>
<workingDirectory>${project.basedir}</workingDirectory>
<nodeVersion>v8.16.1</nodeVersion>
<downloadRoot>http://npm.taobao.org/mirrors/node/</downloadRoot>
</configuration>
<executions>
@yangl
yangl / ES配置参考.md
Last active Aug 8, 2019
ES配置参考
View ES配置参考.md

部署

部署时,考虑的三个点:

  • 后勤方面:硬件,部署策略建议
  • 更适合生产环境的配置更改
  • 部署后的考虑:安全,最大限度的索引性能,备份

硬件

ES为重cpu、重io、重内存应用场景。性能更好的cpu能提升查询效率,更多的内存、更快的磁盘io对于写入能带来更好的提升。

View grpc_nginx.conf
upstream itao_bds_core_11800 {
server 10.203.24.7:11800;
server 10.203.24.9:11800;
server 10.203.24.12:11800;
server 10.203.24.60:11800;
}
server {
listen 1080 http2;
server_name apm-api.intsit.sfdc.com.cn;
@yangl
yangl / 1-YamlPropertySourceFactory.java
Last active Jul 12, 2019
spring-boot2 读取自定义yml文件 <code>YAML files cannot be loaded by using the @PropertySource annotation. </code> 详见:https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html#boot-features-external-config-yaml-shortcomings
View 1-YamlPropertySourceFactory.java
package com.vip.saturn.job.console.config;
import org.springframework.boot.env.YamlPropertySourceLoader;
import org.springframework.core.env.PropertySource;
import org.springframework.core.io.support.EncodedResource;
import org.springframework.core.io.support.PropertySourceFactory;
import java.io.IOException;
import java.util.List;
@yangl
yangl / EpollChannelConfig.java
Last active Jun 12, 2019
Netty Epoll的LT、ET模式使用场景,详见注释。
View EpollChannelConfig.java
/**
* Set the {@link EpollMode} used. Default is
* {@link EpollMode#EDGE_TRIGGERED}. If you want to use {@link #isAutoRead()} {@code false} or
* {@link #getMaxMessagesPerRead()} and have an accurate behaviour you should use
* {@link EpollMode#LEVEL_TRIGGERED}.
*
* <strong>Be aware this config setting can only be adjusted before the channel was registered.</strong>
*/
public EpollChannelConfig setEpollMode(EpollMode mode) {
if (mode == null) {
@yangl
yangl / pulsar_cluster.md
Last active Sep 5, 2019
Apache Pulsar cluster
View pulsar_cluster.md
PULSAR_EXTRA_OPTS="-Dstats_server_port=18000" bin/pulsar-daemon start zookeeper


bin/pulsar initialize-cluster-metadata \
  --cluster sf-pulsar-1 \
  --zookeeper sfpulsar2:2181,sfpulsar3:2181,sfpulsar4:2181/pulsar-zk \
  --configuration-store sfpulsar2:2181,sfpulsar3:2181,sfpulsar4:2181/pulsar-cs \
  --web-service-url http://pulsar1.sfidc.com:8080 \
@yangl
yangl / 0-pulsar_win10_debug.md
Last active May 21, 2019
pulsar win10上IDEA调试,目前pulsar对windows支持并不太好,凑乎还能跑起来(比如zk中的路径还是"\",从而报错)
View 0-pulsar_win10_debug.md

Broker启动

Main class: org.apache.pulsar.PulsarStandaloneStarter
VM Options: -Dlog4j2.configurationFile=D:\opensource\pulsar\conf\log4j2.xml
Projram arguments: --config conf/standalone.conf --no-functions-worker --no-stream-storage --wipe-data

win7如果已使用管理员权限了但仍旧报没有权限创建文件的错误可以再把--no-stream-storage参数给打开关闭Local bookies stream storage

@yangl
yangl / docker.sh
Last active May 11, 2019
spring-boot-saturn Dockerfile 例子 在外边调用dubbo内部的start.sh并tail -f /dev/null阻止容器退出
View docker.sh
docker build -t saturn-console:latest ./
docker run --rm --name=saturn-console -itd -p28080:8080 -e DB_USER=root -e DB_PASSWORD=67890 saturn-console:latest
docker exec -it saturn-console /bin/sh
docker save xxxx > myap.tar
tar -zcvf myap.tar.gz myap.tar
You can’t perform that action at this time.