- kubernetes 安装:https://me.jinchuang.org/archives/441.html
- kubernete 认证:https://www.sharpcode.cn/devops/kubernetes-authn-authz/
- kubernetes ConfigMap 和 Secrets:https://www.qikqiak.com/post/understand-kubernetes-configmap-and-secrets/
- Secret 的使用:https://www.qikqiak.com/post/use-secret-in-k8s/
- Kubernetes RBAC 详解:https://www.qikqiak.com/post/use-rbac-in-k8s/
- Kubernetes Operator 快速入门教程:https://www.qikqiak.com/post/k8s-operator-101/
- kubernetes 持久化存储(一): https://www.qikqiak.com/post/kubernetes-persistent-volume1/
- CentOS 7 下 yum 安装和配置 NFS(k8s NFS环境搭建):https://qizhanming.com/blog/2018/08/08/how-to-install-nfs-on-centos-7
- kubernetes包管理工具helm和tiller的安装:https://www.jianshu.com/p/e3483d9439f2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.*; | |
import java.util.*; | |
import sun.jvm.hotspot.memory.*; | |
import sun.jvm.hotspot.oops.*; | |
import sun.jvm.hotspot.debugger.*; | |
import sun.jvm.hotspot.runtime.*; | |
import sun.jvm.hotspot.tools.*; | |
import sun.jvm.hotspot.utilities.*; | |
public class DirectMemorySize extends Tool { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ChannelInboundHandlerAdapter | |
@Override | |
public void channelRead(ChannelHandlerContext ctx, Object msg) { | |
System.out.println(ìServer received: ì + msg); | |
ctx.write(msg) #2 | |
} | |
@Override | |
public void channelReadComplete(ChannelHandlerContext ctx) { | |
ctx.writeAndFlush(Unpooled.EMPTY_BUFFER) | |
.addListener(ChannelFutureListener.CLOSE); #3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1、ByteBuf支持同时读写操作,包含writerIndex和readerIndex两个变量,如果readerIndex值超过writerIndex,将会抛出IndexOutOfBoundsException错误。 | |
2、ByteBuf支持head buffer(jvm堆中)和direct buffer,堆外分配buffer成本更高。 | |
3、使用ByteBuffer实例: | |
ByteBuf heapBuf = ...; | |
if (heapBuf.hasArray()) { #1 | |
byte[] array = heapBuf.array(); #2 | |
int offset = heapBuf.arrayOffset() + heapBuf.position(); #3 | |
int length = heapBuf.readableBytes(); #4 | |
YourImpl.method(array, offset, length); #5 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Send HTTP GET Request | |
String url = "http://www.google.com/search?q=httpClient"; | |
HttpClient client = HttpClientBuilder.create().build(); | |
HttpGet request = new HttpGet(url); | |
// add request header | |
request.addHeader("User-Agent", USER_AGENT); | |
HttpResponse response = client.execute(request); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.github.melin.concurrnt.future; | |
import java.util.concurrent.CompletableFuture; | |
import java.util.concurrent.Executor; | |
import java.util.concurrent.Executors; | |
import java.util.concurrent.TimeUnit; | |
import java.util.function.BiFunction; | |
import java.util.function.Consumer; | |
import java.util.function.Function; | |
import java.util.function.Supplier; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ArrayQueueSemaphore implements Queue { | |
private final Semaphore notFull = new Semaphore(10); | |
private final Semaphore notEmpty = new Semaphore(0); | |
private final ReentrantLock lock = new ReentrantLock(); | |
private final String[] connections = new String[10]; | |
int putIndex, takeIndex, count; | |
public void put(String e) throws InterruptedException { | |
notFull.acquire(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* BTrace Script Template */ | |
import com.sun.btrace.annotations.*; | |
import static com.sun.btrace.BTraceUtils.*; | |
import java.lang.reflect.Field; | |
@BTrace | |
public class TracingScript { | |
/* | |
* 获取方参数、返回值信息;获取方法调用时间 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##服务代码 | |
```python | |
#!/usr/bin/env python2 | |
#coding=utf-8 | |
import tornado.ioloop | |
import tornado.web | |
from tornado.escape import json_encode |
国内从 Docker Hub 拉取镜像有时会遇到困难,此时可以配置镜像加速器。
Dockerized 实践 https://github.com/y0ngb1n/dockerized