mirror of
https://gitee.com/hyperf/hyperf.git
synced 2024-12-02 03:37:44 +08:00
32 lines
410 B
Markdown
32 lines
410 B
Markdown
# ETCD
|
|
|
|
## 安裝
|
|
|
|
```
|
|
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;
|
|
use Hyperf\Etcd\KVInterface;
|
|
|
|
$client = ApplicationContext::getContainer()->get(KVInterface::class);
|
|
```
|