Posts

https://kubernetes.io/blog/2018/11/07/grpc-load-balancing-on-kubernetes-without-tears/

Allow more ways of creating objects using literals Introduce new datatypes together with their operators and expressions. Closure simple abbreviated syntax of closures: after a method call, put code in braces with parameters delimited from the closure body by an arrow. log = '' (1..10).each{ log += it } assert log == '12345678910' log = '' (1..10).each{ counter -> log += counter } assert log == '12345678910' A second way of declaring a closure is to directly assign it to a variable:

install client pip install shadowsocks client.json { "server":"server-ip", "server_port":8000, "local_port":3050, "password":"your-password", "timeout":600, "method":"aes-256-cfb" } { "server":"your_server_ip", #ss服务器IP "server_port":your_server_port, #端口 "local_address": "127.0.0.1", #本地ip "local_port":1080, #本地端口 "password":"your_server_passwd",#连接ss密码 "timeout":300, #等待超时 "method":"rc4-md5", #加密方式 "fast_open": false, # true 或 false。如果你的服务器 Linux 内核在3.7+,可以开启 fast_open 以降低延迟。开启方法: echo 3 > /proc/sys/net/ipv4/tcp_fastopen 开启之后,将 fast_open 的配置设置为 true 即可 "workers": 1 # 工作线程数 } sudo apt-get install privoxy /etc/privoxy/config listen-address 127.0.0.1:8118 forward-socks5 / 127.0.0.1:1080 . systemctl restart privoxy.

setup <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency> enable web client all endpoints are exposed to JMX and WEB clents By default, all endpoints except for shutdown are enabled. enable all endpoings enable all endpoints accessed by web management: endpoints: enabled-by-default: true web: exposure: include: "*" https://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-endpoints.html WebApplicationType spring: main: web-application-type: reactive NONE The application should not run as a web application and should not start an embedded web server.

docker run -it -p 9090:9090 -p 1883:1883 -p 5683:5683/udp -v ~/.mytb-data:/data -v ~/.mytb-logs:/var/log/thingsboard --name mytb --restart always thingsboard/tb:2.3.1

default credentials:

Systen Administrator: [email protected] / sysadmin
Tenant Administrator: [email protected] / tenant
Customer User: [email protected] / customer

Manage device credentials

login as tenant

Single File Components single-file components with a .vue extension is build by tools such as Webpack or Browserify A single-file component consists of three parts: - <template> which contains the component’s markup in plain HTML - <script> which exports the component object constructor that consists of all the JS logic within that component - <style> which contains all the component styles CORE Virtual DOM Component-based UI Focus on the view library—separate concerns for routing, state management Official component library for building mobile apps

install winpcap and windump https://www.winpcap.org mv windump tcpdump list all interfaces tcpdump -D dump on interface tcpdump -i 1 -n dst host 172.17.17.6 tcpdump -i 3 tcp port 8100 tcpdump: listening on \Device\NPF_{BE2B782C-98A1-49A3-8F59-25C5A41A4B41} 10:08:11.958366 IP loaclhost.49692 > wu-pc.8100: S 2181860964:2181860964(0) win 64240 <mss 1460,nop,wscale 8,nop,nop,sackOK> 10:08:11.958513 IP wu-pc.8100 > loaclhost.49692: S 2062460989:2062460989(0) ack 2181860965 win 65535 <mss 1460,nop,wscale 8,nop,nop,sackOK> 10:08:11.979568 IP loaclhost.49692 > wu-pc.8100: . ack 1 win 513 10:08:11.

spring-cloud-greenwich-release

To get started with Maven with a BOM (dependency management only):

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-dependencies</artifactId>
            <version>Greenwich.RELEASE</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>
<dependencies>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-config</artifactId>
    </dependency>    
</dependencies>

JVM bind with IPv4 Disable IPv6 address lookups when -Djava.net.preferIPv4Stack=true -Djava.net.preferIPv4Stack=true Spring构造注入不需要加@Autowired spring在4.x版本后就推荐使用构造器的方式的来注入fileld 官方推荐理由 单一职责: 当使用构造函数注入的时候,你会很容易发现参数是否过多,这个时候需要考虑你这个类的职责是否过大,考虑拆分的问题;而当使用@Autowired注入field的时候,不容易发现问题 依赖不可变: 只有使用构造函数注入才能注入final 依赖隐藏:使用依赖注入容器意味着类不再对依赖对象负责,获取依赖对象的职责就从类抽离出来,IOC容器会帮你自动装备。这意味着它应该使用更明确清晰的公用接口方法或者构造器,这种方式就能很清晰的知道类需要什么和到底是使用setter还是构造器 降低容器耦合度: 依赖注入框架的核心思想之一是托管类不应依赖于所使用的DI容器。换句话说,它应该只是一个普通的POJO,只要您将其传递给所有必需的依赖项,就可以独立地实例化。这样,您可以在单元测试中实例化它,而无需启动IOC容器并单独进行测试(使用一个可以进行集成测试的容器)。如果没有容器耦合,则可以将该类用作托管或非托管类,甚至可以切换到新的DI框架。 Spring Boot Actuator <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency> Actuator comes with most endpoints disabled. Thus, the only two available by default are /health and /info. management.endpoints.web.exposure.include=* by default, all Actuator endpoints are now placed under the /actuator path mvn dependency:tree [INFO] +- org.springframework.boot:spring-boot-starter-data-jpa:jar:2.1.4.RELEASE:compile [INFO] | +- org.

Start Dgraph cluster

dgraph zero

start Dgraph server

 dgraph server --memory_mb 2048 --zero localhost:5080 --port_offset 2000

 Note:port_offsetValue added to all listening port numbers. [Internal=7080, HTTP=8080, Grpc=9080]

How do I configure Go to use a proxy

https://stackoverflow.com/questions/10383299/how-do-i-configure-go-to-use-a-proxy

Web based graph visualization with D3 and KeyLines

https://cambridge-intelligence.com/web-graph-visualization-d3-keylines/

SETUP CLIENT

set http_proxy=192.168.0.119:3128
git config --global http.proxy http://192.168.0.119:3128
go get -u github.com/derekparker/delve/cmd/dlv
go get -u -v github.com/dgraph-io/dgo

SNAPSHOT // Snapshot is an internally consistent snapshot of xDS resources. // Consistentcy is important for the convergence as different resource types // from the snapshot may be delivered to the proxy in arbitrary order. type Snapshot struct { // Endpoints are items in the EDS response payload. Endpoints Resources // Clusters are items in the CDS response payload. Clusters Resources // Routes are items in the RDS response payload.

envoy.yaml.tmpl admin: access_log_path: /tmp/admin_access.log address: socket_address: { address: 0.0.0.0, port_value: 9901 } static_resources: listeners: - name: listener_0 address: socket_address: { address: 0.0.0.0, port_value: 80 } filter_chains: - filters: - name: envoy.http_connection_manager config: stat_prefix: ingress_http route_config: name: local_route virtual_hosts: - name: local_service domains: ["*"] routes: - match: { prefix: "/" } route: { host_rewrite: nginx, cluster: nginx_cluster, timeout: 60s } http_filters: - name: envoy.router clusters: - name: nginx_cluster connect_timeout: 0.25s type: STRICT_DNS dns_lookup_family: V4_ONLY lb_policy: ${ENVOY_LB_ALG} hosts: [{ socket_address: { address: ${SERVICE_NAME}, port_value: 80 }}] docker-entrypoint.

To ensure stable network ID , need to define a headless service for stateful applications StatefulSets are valuable for applications that require one or more of the following. Stable, unique network identifiers. Stable, persistent storage. Ordered, graceful deployment and scaling. Ordered, automated rolling updates `headless-nginx.yaml’ apiVersion: v1 kind: Service metadata: name: nginx labels: app: nginx spec: ports: - port: 80 name: web clusterIP: None selector: app: nginx --- apiVersion: apps/v1 kind: StatefulSet metadata: name: web spec: selector: matchLabels: app: nginx # has to match .

术语 端点 Envoy discovers the cluster members via EDS Management server: A logical server implementing the v2 Envoy APIs Upstream: An upstream host receives connections and requests from Envoy and returns responses xDS: CDS/EDS/HDS/LDS/RLS/RDS/SDS APIs. Configuration Cache: cache Envoy configurations in memory in an attempt to provide fast response to consumer Envoys The simplest way to use Envoy without providing the control plane in the form of a dynamic API is to add the hardcoded configuration to a static yaml file.

常用命令

常用命令

bandwidth utilization tool

wget -qO- https://github.com/imsnif/bandwhich/releases/download/${WHAT_VERSION}/bandwhich-v${WHAT_VERSION}-x86_64-unknown-linux-musl.tar.gz |  tar xvz -C ~/bin/


bandwhich

TCP

tcpdump-windows

TCP DUMP

禁止启动时候恢复页面提示 Version 73.0.3683.86 (Official Build) (64-bit) 方法1(可靠) 首先关闭chrome,然后修改下面的设置,修改完后重启 .config/google-chrome/Default/Preferences sed -i '/exit_type:Crashed/exit_type:Normal/` windows用户请参考下面的视频 Chrome Didn’t Shut Down Correctly Error Solved Windows 7 方法2(不可靠) Type in address bar (Crtl+L). chrome://flags/#infinite-session-restore Click on the right drop-down menu and change the ‘Default’ value to ‘Disable’. Then restart Chrome to apply that setting enter password to unlock your keyring 方法1(可靠) set password-store to basic dpkg -L google-chrome-stable |grep desktop | xargs cp {1} ~/.

helm install --debug install/kubernetes/helm/istio --name istio --namespace istio-system --set security.enabled=false --set ingress.enabled=false --set gateways.istio-ingressgateway.enabled=false --set gateways.istio-egressgateway.enabled=false --set galley.enabled=false --set mixer.enabled=false --set prometheus.enabled=false --set global.proxy.envoyStatsd.enabled=false --set pilot.sidecar=false --set sidecarInjectorWebhook.enabled=false [debug] Created tunnel using local port: '44471' [debug] SERVER: "127.0.0.1:44471" [debug] Original chart version: "" [debug] CHART PATH: /home/bigo/istio/install/kubernetes/helm/istio NAME: istio REVISION: 1 RELEASED: Sat Mar 30 06:30:03 2019 CHART: istio-1.0.6 USER-SUPPLIED VALUES: galley: enabled: false gateways: istio-egressgateway: enabled: false istio-ingressgateway: enabled: false global: proxy: envoyStatsd: enabled: false ingress: enabled: false mixer: enabled: false pilot: sidecar: false prometheus: enabled: false security: enabled: false sidecarInjectorWebhook: enabled: false COMPUTED VALUES: certmanager: enabled: false hub: quay.

for developers building applications to run in Kubernetes clusters, and for DevOps staff troubleshooting Kubernetes applications. Features include: View your clusters in an explorer tree view, and drill into workloads, services, pods and nodes. Browse Helm repos and install charts into your Kubernetes cluster. Intellisense for Kubernetes resources and Helm charts and templates. Edit Kubernetes resource manifests and apply them to your cluster. Build and run containers in your cluster from Dockerfiles in your project.

go模块代理

https://github.com/goproxy/goproxy.cn

$go version
go version go1.13.12 linux/amd64
go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.cn,direct
  • 重置goproxy

    go env -w GOPROXY
    

go doc

https://golang.google.cn

proxy

  • 从 Github 的代码库 clone

    go get -u github.com/golang/text
    mv $GOPATH/src/github.com/golang/text $GOPATH/src/golang.org/x/text
    
    go get -u github.com/golang/crypto
    mv $GOPATH/src/github.com/golang/crypto $GOPATH/src/golang.org/x/crypto
    
  • 设置 GOPROXY 环境变量配置代理

例如:GOPROXY=https://goproxy.io

https://github.com/northbright/Notes/blob/master/Golang/china/get-golang-packages-on-golang-org-in-china.md

https://gocn.vip/article/1678

配置代理

v3.11.0->k8s 1.11 openshift all-in-one curl https://github.com/openshift/origin/releases/download/v3.11.0/openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit.tar.gz tar zxf openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit.tar.gz cd openshift export PATH="$(pwd)":$PATH sudo ./openshift start master oc setup export KUBECONFIG="$(pwd)"/openshift.local.config/master/admin.kubeconfig export CURL_CA_BUNDLE="$(pwd)"/openshift.local.config/master/ca.crt sudo chmod +r "$(pwd)"/openshift.local.config/master/admin.kubeconfig openshift complition bash > /usr/share/bash-completion/completions/openshift.complition.sh master and node configuration after installation /etc/origin/master/master-config.yaml identityProviders: - name: my_allow_provider challenge: true login: true provider: apiVersion: v1 kind: AllowAllPasswordIdentityProvider corsAllowedOrigins Identity Providers The OpenShift master includes a built-in OAuth server the Deny All identity provider is used by default, which denies access for all user names and passwords.