kubectl create namespace tanzu-data
kubectl config set-context --current --namespace=tanzu-data
cd /Users/Projects/VMware/Tanzu/TanzuData/TanzuGemFire/dev/gemfire-showcase
kubectl apply -f deployment/cloud/k8/data-services/gemfire/gemfire1-2loc-2data.yml --namespace=tanzu-data
apiVersion: gemfire.tanzu.vmware.com/v1
kind: GemFireCluster
metadata:
name: gemfire1
spec:
image: registry.pivotal.io/tanzu-gemfire-for-kubernetes/gemfire-k8s:1.0.1
locators:
replicas: 1
overrides:
gemfireProperties:
distributed-system-id: "1"
servers:
replicas: 2
overrides:
jvmOptions:
- "-Djava.awt.headless=true"
- "-Dsun.rmi.dgc.server.gcInterval=9223372036854775806"
- "-XX:+UseG1GC"
- "-XX:+PrintGCDetails"
- "-XX:MaxGCPauseMillis=40"
- "-Xms674m"
- "-Xmx674m"
- "-Dgemfire.statistic-sample-rate=5000"
- "-Dgemfire.enable-time-statistics=true"
- "-Dgemfire.statistic-sampling-enabled=true"
- "-Dgemfire.standard-output-always-on=true"
- "-Dgemfire.archive-file-size-limit=10"
- "-Dgemfire.conserve-sockets=false"
- "-Dgemfire.prometheus.metrics.port=4321"
- "-Dgemfire.log-disk-space-limit=409"
- "-Dgemfire.archive-disk-space-limit=409"
- "-Dgemfire.log-file-size-limit=100"
- "-Dgemfire.locator-wait-time=120"
- "-Dgemfire.ALLOW_PERSISTENT_TRANSACTIONS=true"
gemfireProperties:
distributed-system-id: "1"
Look for gemfire1-locator-0, gemfire1-server-0 gemfire1-server-1
kubectl get pods -w --namespace=tanzu-data
kubectl get configmap gemfire1-config --namespace=tanzu-data -o yaml
kubectl exec -it gemfire1-locator-0 -- gfsh -e "connect --locator=gemfire1-locator-0.gemfire1-locator.tanzu-data.svc.cluster.local[10334]" -e "create region --name=Account --type=PARTITION_REDUNDANT_PERSISTENT"
kubectl apply -f deployment/cloud/k8/apps/userAccount-service/userAccount-service.yml --namespace=tanzu-data
Example Yaml
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
run: userAccount-service-gemfire-showcase
name: userAccount-service-gemfire-showcase
spec:
replicas: 1
selector:
matchLabels:
name: userAccount-service-gemfire-showcase
template:
metadata:
labels:
name: userAccount-service-gemfire-showcase
spec:
containers:
- env:
- name: management.endpoint.health.enabled
value: "true"
- name: management.endpoint.health.probes.enabled
value: "true"
- name: server.port
value: "8080"
- name: spring.data.gemfire.pool.locators
valueFrom:
configMapKeyRef:
name: gemfire1-config
key: locators
image: cloudnativedata/userAccount-service-gemfire-showcase:0.0.1-SNAPSHOT
name: userAccount-service-gemfire-showcase
imagePullPolicy: "Always"
# imagePullPolicy: "IfNotPresent"
livenessProbe:
httpGet:
path: /actuator/health/liveness
port: 8080
initialDelaySeconds: 40
timeoutSeconds: 2
periodSeconds: 3
failureThreshold: 2
readinessProbe:
httpGet:
path: /actuator/health/readiness
port: 8080
initialDelaySeconds: 40
timeoutSeconds: 2
periodSeconds: 3
failureThreshold: 2
---
apiVersion: v1
kind: Service
metadata:
name: userAccount-service-gemfire-showcase
spec:
selector:
name: userAccount-service-gemfire-showcase
ports:
- protocol: TCP
port: 8080
targetPort: 8080
type: LoadBalancer
- use the watch command util the application userAccount-rest-service pod state is ready (Control^C to stop)
kubectl get pods -w --namespace=tanzu-data
export API_HTTP_HOST=`kubectl get services userAccount-service-gemfire-showcase --output jsonpath='{.status.loadBalancer.ingress[0].ip}' --namespace=tanzu-data`
echo $API_HTTP_HOST
curl -X 'POST' \
"http://$API_HTTP_HOST:8080/accounts" \
-H 'accept: */*' \
-H 'Content-Type: application/json' \
-d '{ "id": "1", "name": "Acct 1" }' ; echo
curl -X 'GET' "http://$API_HTTP_HOST:8080/accounts/1" -H 'accept: */*' ; echo
kubectl exec -it gemfire1-locator-0 -- gfsh
connect --locator=gemfire1-locator-0.gemfire1-locator.tanzu-data.svc.cluster.local[10334]
list members
list clients
kubectl delete pod gemfire1-server-0 --namespace=tanzu-data
kubectl exec -it gemfire1-locator-0 -- gfsh -e "connect --locator=gemfire1-locator-0.gemfire1-locator.tanzu-data.svc.cluster.local[10334]" -e "list members"
kubectl get pods -w --namespace=tanzu-data
If in different shell
export API_HTTP_HOST=`kubectl get services userAccount-service-gemfire-showcase --output jsonpath='{.status.loadBalancer.ingress[0].ip}' --namespace=tanzu-data`
curl -X 'GET' "http://$API_HTTP_HOST:8080/accounts/1" -H 'accept: */*' ; echo
cd /Users/Projects/VMware/Tanzu/TanzuData/TanzuGemFire/dev/gemfire-showcase
kubectl apply -f deployment/cloud/k8/data-services/gemfire/gemfire1-2loc-3data.yml --namespace=tanzu-data
apiVersion: gemfire.tanzu.vmware.com/v1
kind: GemFireCluster
metadata:
name: gemfire1
spec:
image: registry.pivotal.io/tanzu-gemfire-for-kubernetes/gemfire-k8s:1.0.1
locators:
replicas: 2
overrides:
gemfireProperties:
distributed-system-id: "1"
servers:
replicas: 3
overrides:
jvmOptions:
- "-Djava.awt.headless=true"
- "-Dsun.rmi.dgc.server.gcInterval=9223372036854775806"
- "-XX:+UseG1GC"
- "-XX:+PrintGCDetails"
- "-XX:MaxGCPauseMillis=40"
- "-Xms674m"
- "-Xmx674m"
- "-Dgemfire.statistic-sample-rate=5000"
- "-Dgemfire.enable-time-statistics=true"
- "-Dgemfire.statistic-sampling-enabled=true"
- "-Dgemfire.standard-output-always-on=true"
- "-Dgemfire.archive-file-size-limit=10"
- "-Dgemfire.conserve-sockets=false"
- "-Dgemfire.prometheus.metrics.port=4321"
- "-Dgemfire.log-disk-space-limit=409"
- "-Dgemfire.archive-disk-space-limit=409"
- "-Dgemfire.log-file-size-limit=100"
- "-Dgemfire.locator-wait-time=120"
- "-Dgemfire.ALLOW_PERSISTENT_TRANSACTIONS=true"
gemfireProperties:
distributed-system-id: "1"
Or
kubectl edit gemfirecluster gemfire1 --namespace=tanzu-data
kubectl get pods -w --namespace=tanzu-data
curl -X 'GET' "http://$API_HTTP_HOST:8080/accounts/1" -H 'accept: */*' ; echo
curl -X 'POST' \
"http://$API_HTTP_HOST:8080/accounts" \
-H 'accept: */*' \
-H 'Content-Type: application/json' \
-d '{ "id": "2", "name": "Acct 2" }' ; echo
curl -X 'GET' "http://$API_HTTP_HOST:8080/accounts/2" -H 'accept: */*' ; echo
Create Region
kubectl exec -it gemfire1-locator-0 -- gfsh -e "connect --locator=gemfire1-locator-0.gemfire1-locator.tanzu-data.svc.cluster.local[10334]" -e "create region --name=test --type=PARTITION_PERSISTENT"
Start PerfTest
kubectl apply -f deployment/cloud/k8/apps/gemfire-perf-test/gemfire-perf-test.yml --namespace=tanzu-data
kubectl get pods -w --namespace=tanzu-data
--namespace=tanzu-data
Clean
kubectl delete -f deployment/cloud/k8/apps/gemfire-perf-test/gemfire-perf-test.yml --namespace=tanzu-data
k delete pod gemfire1-server-1 --namespace=tanzu-data
kubectl exec -it gemfire1-locator-0 -- gfsh -e "connect --locator=gemfire1-locator-0.gemfire1-locator.tanzu-data.svc.cluster.local[10334]" -e "destroy region --name=test"
Clean up
k delete -f cloud/k8/data-services/gemfire/gemfire1-2loc-2server.yml