Wednesday, 17 August 2022

Accessing ElasticSearch in TestContainer


During the Unit test or Integration test, it may need to verify if a document having been persisted successfully.  


Using UI tool



Using command

docker ps to list all containers, and find out elastic container port(exposure port) number

ac8dec5773de   docker.elastic.co/elasticsearch/elasticsearch:8.1.3   "/bin/tini -- /usr/l…"   4 days ago       Up 4 days       0.0.0.0:64595->9200/tcp, 0.0.0.0:64596->9300/tcp   vigilant_pike




List all index                                

Sunday, 7 August 2022

Kubernetes

Terms

Cluster: a set of nodes.

Node:  a virtual machine(VM) or physical machine. 

Master node: managing working workers.

Worker node: running applications.

Pod: a pod is the smallest deployable unit in K8s and not containers. A pod enclose containers and volumes(used for sharing data among containers). A pod has a unique IP address. 


Run K8 locally

Minikube:  installing docker + minikube


Kubectl

K8 command line tool,  providing commands to gain your cluster residing in the minikube

then we may deploy, inspect, edit resources, debug, and view logs.


minikube start > start the k8

kubectl get nodes> showing all nodes running in the k8

kubectl get pods -A > showing all pods in all namespaces


creating k8 deployment.yml VC.

kubectl apply -f deployment.yml


kubectl get svc>  get service(defined in deployment YAML file service section)

minikube service myapp : access service port


start tunnel for service myapp via URL








Thursday, 4 August 2022

Thread Resources

 A Java thread uses 20M memory space and needs about 10ms to launch it. 

So for a laptop having 16G memory, it can host about 800 threads. 


Can Jackson Deserialize Java Time ZonedDateTime

Yes, but must include JSR310. Thus ZonedDateTime can be deserialized directly from JSON response to POJO field. <dependency> <g...