ETCD

安装

  1. composer require hyperf/etcd

添加配置文件 etcd.php

  1. <?php
  2. return [
  3. 'uri' => 'http://192.168.1.200:2379',
  4. 'version' => 'v3beta',
  5. 'options' => [
  6. 'timeout' => 10,
  7. ],
  8. ];

使用

  1. <?php
  2. use Hyperf\Utils\ApplicationContext;
  3. use Hyperf\Etcd\KVInterface;
  4. $client = ApplicationContext::getContainer()->get(KVInterface::class);