Posts

https://www.freecodecamp.org/news/rest-is-the-new-soap-97ff6c09896d/

https://stackoverflow.com/questions/44547574/create-api-gateway-in-localstack/48682628

https://github.com/localstack/localstack/issues/632

AWS SAM is an extension for the AWS CloudFormation template language that lets you define serverless applications at a higher level

localstack default regrion

us-east-1

create stack

file path has to be in file URL format(file:///home/user/…)

func.yaml

AWSTemplateFormatVersion: '2010-09-09'
Description: Simple CloudFormation Test Template
Resources:
  S3Bucket:
    Type: AWS::S3::Bucket
    Properties:
      AccessControl: PublicRead
      BucketName: test-bucket-1
aws cloudformation create-stack --stack-name funstack --template-body file:///data/func.yaml --endpoint-url=http://localhost:4581 --region us-east-1
aws cloudformation describe-stacks  --endpoint-url=http://localhost:4581 --region us-east-1


设计目标

  • 存取(入库和分析)高效

  • 节省存储空间

评估单台设备基于采集评率的每年存储成本

http://mysql.rjweb.org/doc.php/datawarehouse

docker proxy

run cmd as administrator
cmd>cd $GIT_HOME
cmd>echo > .bash_profile
export HTTP_PROXY=http://127.0.0.1:1080
export HTTPS_PROXY=http://127.0.0.1:1080
export no_proxy=localhost,127.0.0.1,192.168.99.100

execution environment Creates an execution environment that represents the context in which the program is currently executed. If the program is invoked standalone, this method returns a local execution environment. If the program is invoked from within the command line client to be submitted to a cluster, this method returns the execution environment of this cluster. REST instead of akka in 1.5 changing the client to communicate via REST instead of akka.

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