hyperf/docs/zh-cn/etcd.md

32 lines
410 B
Markdown
Raw Normal View History

2019-06-01 18:27:24 +08:00
# ETCD
2021-02-24 14:17:31 +08:00
## 安装
```
composer require hyperf/etcd
```
## 添加配置文件 `etcd.php`
```php
<?php
return [
'uri' => 'http://192.168.1.200:2379',
'version' => 'v3beta',
'options' => [
'timeout' => 10,
],
];
```
## 使用
```php
<?php
use Hyperf\Context\ApplicationContext;
2021-02-24 14:17:31 +08:00
use Hyperf\Etcd\KVInterface;
$client = ApplicationContext::getContainer()->get(KVInterface::class);
```