Skip to content

Instantly share code, notes, and snippets.

View yangl's full-sized avatar
🎯
Focusing

YANGLiiN yangl

🎯
Focusing
View GitHub Profile
@yangl
yangl / Kafka消息大小相关参数配置.md
Last active January 2, 2020 09:10
Kafka消息大小相关参数配置,单个消息最大调整为10240000场景

Broker

message.max.bytes=10485760  (默认1M,注:单个topic级别配置为max.message.bytes,小心坑)
# replica.fetch.max.bytes=10485760  (默认1M)
def maybeWarnIfOversizedRecords(records: MemoryRecords, topicPartition: TopicPartition): Unit = {
  // oversized messages don't cause replication to fail from fetch request version 3 (KIP-74)
@yangl
yangl / IdentityReplicationPolicy.java
Last active July 6, 2021 09:49
Kafka MirrorMaker 2.0 单向同步不改为topic名称 https://cwiki.apache.org/confluence/display/KAFKA/KIP-382%3A+MirrorMaker+2.0 MM2现在已支持同步消费组offset同步了 http://kafka.apache.org/documentation/#connectconfigs
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@yangl
yangl / kafka_no_message_lose_order.md
Last active August 29, 2019 08:04
Kafka保证有序且不丢失配置

不开启事务 情况下

Producer

block.on.buffer.full=true
retries=Integer.MAX_VALUE
acks=all
max.in.flight.requests.per.connection=1
// 设置DNS缓存时长: 秒
Security.setProperty("networkaddress.cache.ttl", "10");
Security.setProperty("networkaddress.cache.negative.ttl", "3");
@yangl
yangl / frontend-maven-plugin.xml
Created August 19, 2019 02:37
项目内自定义Node.js版本
<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 August 8, 2019 08:08
ES配置参考

部署

部署时,考虑的三个点:

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

硬件

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

upstream itao_bds_core_11800 {
hash $request_uri;
# hash $remote_addr consistent;
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 {
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 June 12, 2019 06:25
Netty Epoll的LT、ET模式使用场景,详见注释。
/**
* 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 / bookkeeper-topology.conf
Last active December 13, 2022 07:41
Apache Pulsar 机架感知策略 --networkTopologyScript
# bookie-1
10.207.128.13 /SZ/FT
10.207.128.14 /SZ/FT
10.207.128.15 /SZ/FT
10.207.128.16 /SZ/FT
10.207.128.17 /SZ/FT
# bookie-2
10.206.128.204 /SZ/NS
10.206.128.205 /SZ/NS