当前位置:网站首页>Start using dapr

Start using dapr

2022-06-09 16:08:00 Wind god Shura envoy

Official installation tutorial

https://docs.microsoft.com/zh-cn/dotnet/architecture/dapr-for-net-developers/getting-started

dapr install

wget -q https://raw.githubusercontent.com/dapr/cli/master/install/install.sh -O - | /bin/bash
https://github.com/dapr/cli/releases/download/v1.5.1/dapr_linux_amd64.tar.gz 
cp to /bin

start-up

./web-port/run_web.sh
./dapr-api-go/run_api_go.sh

dapr Boot mode

//  rely on Docker The pattern of  , This is easy to start 
dapr init  
//  Do not rely on Docker The pattern of  , You need to start it yourself  ~/.dapr/bin/placement 
dapr init --slim
nohup  ~/.dapr/bin/placement &

To configure consul server colony Reference resources :http://www.hdget.com/dapr-consul-config/

<!--  Download link :https://releases.hashicorp.com/consul -->
<!-- onsul Cluster node (raft Consensus ) -bootstrap-expect  Number of cluster nodes  -bind  This machine ip -join  The initial node to join ip-->
nohup ./consul agent -server -bootstrap-expect 2 -data-dir /tmp/consul -ui -client 0.0.0.0 -bind 192.168.0.5 -join 192.168.0.5 > /var/log/consul.log 2>&1 &
   
nohup ./consul agent -server -ui -data-dir /tmp/consul -client 0.0.0.0 -bind 192.168.0.4 -join 192.168.0.5 > /var/log/consul.log 2>&1 &
   

dapr client () To configure

nano ~/.dapr/config.yaml

apiVersion: dapr.io/v1alpha1
kind: Configuration
metadata:
  name: daprConfig
spec:
  nameResolution:
    component: "consul"
    configuration:
      client:
        address: "192.168.0.5:8500"
      selfRegister: true
OR
apiVersion: dapr.io/v1alpha1
kind: Configuration
metadata:
  name: appconfig
spec:
  nameResolution:
    component: "consul"
    configuration:
      selfRegister: false
nohup ./consul agent -data-dir /tmp/consul -ui -client 0.0.0.0 -bind 192.168.0.7 -join 192.168.0.4 > /var/log/consul.log 2>&1 &

dapr Server side ( The services that need to be registered for discovery are put here ) To configure

apiVersion: dapr.io/v1alpha1
kind: Configuration
metadata:
  name: appconfig
spec:
  nameResolution:
    component: "consul"
    configuration:
      selfRegister: true
OR 
nohup ./consul agent -data-dir /tmp/consul -ui -client 0.0.0.0 -bind 192.168.0.6 -join 192.168.0.5 > /var/log/consul.log 2>&1 &

Registration point

except consul bootstrap-expect Node is not operational dapr Everything else outside the program is OK

原网站

版权声明
本文为[Wind god Shura envoy]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/160/202206091540399694.html