annotate modules/mysql/readmes/README_ja_JP.md @ 432:d05e9281909c

Remove now abandoned Strike Creations website
author IBBoard <dev@ibboard.co.uk>
date Tue, 21 Feb 2023 15:54:18 +0000
parents 668df4711671
children c6c9a2cfcfbd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
244
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1 # mysql
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
2
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
3 #### 目次
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
4
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
5 1. [説明 - モジュールの機能とその有益性](#module-description)
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
6 2. [セットアップ - mysql導入の基本](#setup)
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
7 * [mysqlの導入](#beginning-with-mysql)
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
8 3. [使用方法 - 設定オプションと追加機能](#usage)
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
9 * [サーバオプションのカスタマイズ](#customize-server-options)
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
10 * [データベースを作成します](#create-a-database)
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
11 * [設定のカスタマイズ](#customize-configuration)
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
12 * [既存のサーバに対する操作](#work-with-an-existing-server)
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
13 * [パスワードの指定](#specify-passwords)
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
14 * [CentOSへのPerconaサーバのインストール](#install-percona-server-on-centos)
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
15 * [UbuntuへのMariaDBのインストール](#install-mariadb-on-ubuntu)
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
16 * [プラグインのインストール](#install-plugins)
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
17 4. [参考 - モジュールの機能と動作について](REFERENCE.md)
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
18 5. [制約 - OS互換性など](#limitations)
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
19 6. [開発 - モジュール貢献についてのガイド](#development)
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
20
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
21 ## モジュールの概要
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
22
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
23 mysqlモジュールは、MySQLサービスをインストール、設定、管理します。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
24
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
25 このモジュールは、MySQLのインストールと設定を管理するとともに、データベース、ユーザ、GRANT権限などのMySQLリソースを管理できるようにPuppetの機能を拡張します。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
26
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
27 ## セットアップ
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
28
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
29 ### mysqlの導入
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
30
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
31 デフォルトのオプションを使用してサーバをインストールするには、次のコマンドを使用します。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
32
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
33 `include '::mysql::server'`.
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
34
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
35 ルートパスワードや`/etc/my.cnf`の設定値などのオプションをカスタマイズするには、オーバーライドハッシュも渡す必要があります。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
36
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
37 ```puppet
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
38 class { '::mysql::server':
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
39 root_password => 'strongpassword',
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
40 remove_default_accounts => true,
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
41 override_options => $override_options
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
42 }
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
43 ```
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
44
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
45 $override_options用のハッシュ構造体の例については、後述の[**サーバオプションのカスタマイズ**](#サーバオプションのカスタマイズ)を参照してください。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
46
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
47 ## 使用
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
48
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
49 サーバに関するすべてのインタラクションは`mysql::server`を使用して行われ、クライアントのインストールには`mysql::client`が、バインディングのインストールには`mysql::bindings`が使用されます。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
50
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
51 ### サーバオプションのカスタマイズ
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
52
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
53 サーバオプションを定義するには、`mysql::server`でオーバーライドのハッシュ構造体を作成します。このハッシュは、my.cnfファイルに含まれているハッシュと似ています。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
54
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
55 ```puppet
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
56 $override_options = {
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
57 'section' => {
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
58 'item' => 'thing',
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
59 }
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
60 }
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
61 ```
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
62
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
63 この形式のオプションを従来の方法で示すと次のようになります。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
64
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
65 ```
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
66 [section]
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
67 thing = X
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
68 ```
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
69
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
70 ハッシュ内では`thing => true`、`thing => value`、または`thing => ""`の形でエントリを作成できます。または、`thing => ['value', 'value2']`の形で配列を渡したり、`thing => value`を独立した行に個別にリストすることもできます。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
71
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
72 値を設定せずに変数をハッシュに含めて渡すことができます。この場合、変数にはMySQLのデフォルトの設定値が使用されます。オプションを`my.cnf`ファイルから除外するには(たとえば`override_options`を使用してデフォルト値に戻す場合など)、`thing => undef`を渡します。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
73
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
74 オプションに複数のインスタンスが必要な場合は配列を渡します。たとえば次の例の場合は、
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
75
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
76 ```puppet
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
77 $override_options = {
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
78 'mysqld' => {
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
79 'replicate-do-db' => ['base1', 'base2'],
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
80 }
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
81 }
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
82 ```
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
83
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
84 次のようになります。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
85
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
86 ```puppet
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
87 [mysqld]
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
88 replicate-do-db = base1
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
89 replicate-do-db = base2
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
90 ```
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
91
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
92 バージョンに固有なパラメータを実装するには、[mysqld-5.5]のようにバージョンを指定します。こうすると、1つのconfigで複数の異なるバージョンのMySQLに対応できます。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
93
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
94 ### データベースを作成します
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
95
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
96 ユーザおよび割り当てられたいくつかの権限を含むデータベースを作成するには、次のようにします。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
97
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
98 ```puppet
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
99 mysql::db { 'mydb':
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
100 user => 'myuser',
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
101 password => 'mypass',
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
102 host => 'localhost',
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
103 grant => ['SELECT', 'UPDATE'],
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
104 }
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
105 ```
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
106
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
107 エクスポートされたリソースを含む別のリソース名を使用するには、次のようにします。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
108
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
109 ```puppet
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
110 @@mysql::db { "mydb_${fqdn}":
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
111 user => 'myuser',
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
112 password => 'mypass',
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
113 dbname => 'mydb',
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
114 host => ${fqdn},
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
115 grant => ['SELECT', 'UPDATE'],
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
116 tag => $domain,
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
117 }
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
118 ```
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
119
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
120 さらに、これをリモートDBサーバに集めることができます。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
121
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
122 ```puppet
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
123 Mysql::Db <<| tag == $domain |>>
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
124 ```
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
125
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
126 データベースの作成時にファイルにsqlパラメータを設定する場合は、新しいデータベースにファイルがインポートされます。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
127
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
128 サイズの大きいsqlファイルの場合は、`import_timeout`パラメータの値(デフォルト値300秒)を大きくします。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
129
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
130 MySQLクライアントを標準のbin/sbin以外のパスにインストールしている場合、`mysql_exec_path`にこれを設定します。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
131
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
132 ```puppet
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
133 mysql::db { 'mydb':
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
134 user => 'myuser',
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
135 password => 'mypass',
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
136 host => 'localhost',
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
137 grant => ['SELECT', 'UPDATE'],
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
138 sql => '/path/to/sqlfile.gz',
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
139 import_cat_cmd => 'zcat',
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
140 import_timeout => 900,
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
141 mysql_exec_path => '/opt/rh/rh-myql57/root/bin'
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
142 }
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
143 ```
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
144
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
145 ### 設定のカスタマイズ
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
146
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
147 MySQLカスタム設定を追加するには、`includedir`にファイルを追加します。こうすると設定値をオーバーライドしたり別の設定値を追加したりすることができ、`mysql::server`で`override_options`を使用しない場合に役立ちます。`includedir`の場所は、デフォルトでは`/etc/mysql/conf.d`に設定されます。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
148
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
149 ### 既存のサーバに対する操作
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
150
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
151 既存のMySQLサーバ上にデータベースとユーザのインスタンスを作成するには、`root`のホームディレクトリに`.my.cnf`ファイルが必要です。次の例のように、このファイルでリモートサーバのアドレスと認証情報を指定する必要があります。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
152
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
153 ```puppet
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
154 [client]
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
155 user=root
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
156 host=localhost
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
157 password=secret
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
158 ```
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
159
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
160 このモジュールは、`mysqld_version`ファクトから、使用されているサーバのバージョンを認識します。デフォルトでは、`mysqld_version`は`mysqld -V`の出力に設定されています。リモートMySQLサーバに対する操作を行う場合は、`mysqld_version`に対応するカスタムファクトを設定しないと正常に動作しない可能性があります。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
161
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
162 リモートサーバに対する操作を行う際には、Puppetマニフェスト内で`mysql::server`クラスを使用*しない*でください。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
163
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
164 ### パスワードの指定
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
165
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
166 パスワードは、プレーンテキストとして渡せるだけでなく、次のようにハッシュとして入力することもできます。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
167
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
168 ```puppet
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
169 mysql::db { 'mydb':
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
170 user => 'myuser',
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
171 password => '*6C8989366EAF75BB670AD8EA7A7FC1176A95CEF4',
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
172 host => 'localhost',
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
173 grant => ['SELECT', 'UPDATE'],
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
174 }
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
175 ```
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
176
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
177 必要に応じて、パスワードも空文字列とし、パスワードなしで接続を許可することができます。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
178
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
179 ### CentOSへのPerconaサーバのインストール
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
180
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
181 次の例は、CentOSシステムへのPerconaサーバの最小限のインストール方法を示します。この例では、Perconaサーバ、クライアント、バインディング(PerlとPythonのバインディングを含む)がセットアップされます。この方法をカスタマイズして必要に応じバージョンを更新することができます。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
182
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
183 この方法は、Puppet 4.4/CentOS 7/Perconaサーバ5.7でテストされています。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
184
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
185 注意:** yumレポジトリのインストールはこのパッケージには含まれていません。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
186
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
187 ```puppet
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
188 yumrepo { 'percona':
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
189 descr => 'CentOS $releasever - Percona',
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
190 baseurl => 'http://repo.percona.com/centos/$releasever/os/$basearch/',
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
191 gpgkey => 'http://www.percona.com/downloads/percona-release/RPM-GPG-KEY-percona',
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
192 enabled => 1,
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
193 gpgcheck => 1,
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
194 }
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
195
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
196 class {'mysql::server':
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
197 package_name => 'Percona-Server-server-57',
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
198 package_ensure => '5.7.11-4.1.el7',
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
199 service_name => 'mysql',
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
200 config_file => '/etc/my.cnf',
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
201 includedir => '/etc/my.cnf.d',
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
202 root_password => 'PutYourOwnPwdHere',
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
203 override_options => {
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
204 mysqld => {
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
205 log-error => '/var/log/mysqld.log',
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
206 pid-file => '/var/run/mysqld/mysqld.pid',
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
207 },
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
208 mysqld_safe => {
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
209 log-error => '/var/log/mysqld.log',
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
210 },
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
211 }
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
212 }
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
213
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
214 # 注意:Percona-Server-server-57をインストールするとPercona-Server-client-57もインストールされます。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
215 # 次の例は、Percona MySQLクライアントを単独でインストールする方法を示します。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
216 class {'mysql::client':
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
217 package_name => 'Percona-Server-client-57',
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
218 package_ensure => '5.7.11-4.1.el7',
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
219 }
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
220
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
221 # 通常、以下のパッケージはPercona-Server-server-57とともにインストールされます。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
222 # バインディングもインストールする必要がある場合は、このコードでインストールできます。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
223 class { 'mysql::bindings':
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
224 client_dev_package_name => 'Percona-Server-shared-57',
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
225 client_dev_package_ensure => '5.7.11-4.1.el7',
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
226 client_dev => true,
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
227 daemon_dev_package_name => 'Percona-Server-devel-57',
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
228 daemon_dev_package_ensure => '5.7.11-4.1.el7',
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
229 daemon_dev => true,
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
230 perl_enable => true,
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
231 perl_package_name => 'perl-DBD-MySQL',
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
232 python_enable => true,
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
233 python_package_name => 'MySQL-python',
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
234 }
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
235
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
236 # Dependencies definition
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
237 Yumrepo['percona']->
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
238 Class['mysql::server']
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
239
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
240 Yumrepo['percona']->
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
241 Class['mysql::client']
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
242
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
243 Yumrepo['percona']->
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
244 Class['mysql::bindings']
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
245 ```
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
246
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
247 ### UbuntuへのMariaDBのインストール
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
248
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
249 #### オプション:MariaDBの公式のレポジトリのインストール
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
250
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
251 次の例では、distroレポジトリでなく公式のMariaDBレポジトリの最新の安定版(現在10.1)を使用しています。代わりに、Ubuntuレポジトリのパッケージを使用することもできます。必要に応じた正しいバージョンのレポジトリを使用してください。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
252
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
253 **注意:** `sfo1.mirrors.digitalocean.com`は利用可能な多くのミラーの一例であり、公式のミラーであればいずれも使用できます。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
254
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
255 ```puppet
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
256 include apt
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
257
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
258 apt::source { 'mariadb':
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
259 location => 'http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.1/ubuntu',
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
260 release => $::lsbdistcodename,
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
261 repos => 'main',
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
262 key => {
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
263 id => '199369E5404BD5FC7D2FE43BCBCB082A1BB943DB',
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
264 server => 'hkp://keyserver.ubuntu.com:80',
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
265 },
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
266 include => {
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
267 src => false,
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
268 deb => true,
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
269 },
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
270 }
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
271 ```
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
272
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
273 #### MariaDBサーバのインストール
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
274
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
275 次の例では、Ubuntu TrustyへのMariaDBサーバのインストール方法を示しています。`my.cnf`のバージョンとパラメータは、必要に応じて調整してください。`my.cnf`のパラメータはすべて`override_options`パラメータを使用して定義できます。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
276
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
277 フォルダ`/var/log/mysql`と`/var/run/mysqld`は自動的に作成されますが、他のカスタムフォルダを使用する場合は、それらがコードの必須要件になります。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
278
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
279 以下に示す値はすべて、最小限の構成にする場合の例です。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
280
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
281 必要なパッケージのバージョンを、`package_ensure`パラメータで指定してください。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
282
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
283 ```puppet
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
284 class {'::mysql::server':
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
285 package_name => 'mariadb-server',
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
286 package_ensure => '10.1.14+maria-1~trusty',
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
287 service_name => 'mysql',
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
288 root_password => 'AVeryStrongPasswordUShouldEncrypt!',
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
289 override_options => {
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
290 mysqld => {
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
291 'log-error' => '/var/log/mysql/mariadb.log',
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
292 'pid-file' => '/var/run/mysqld/mysqld.pid',
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
293 },
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
294 mysqld_safe => {
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
295 'log-error' => '/var/log/mysql/mariadb.log',
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
296 },
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
297 }
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
298 }
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
299
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
300 # 依存関係の管理。レポジトリをインストールする場合はこの例の前のステップで示されている部分だけを使用してください。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
301 Apt::Source['mariadb'] ~>
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
302 Class['apt::update'] ->
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
303 Class['::mysql::server']
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
304
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
305 ```
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
306
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
307 #### MariaDBクライアントのインストール
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
308
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
309 次の例は、MariaDBクライアントとすべてのバインディングを一度にインストールする方法を示します。このインストール操作は、サーバのインストール操作とは別に行うことができます。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
310
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
311 必要なパッケージのバージョンを、`package_ensure`パラメータで指定してください。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
312
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
313 ```puppet
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
314 class {'::mysql::client':
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
315 package_name => 'mariadb-client',
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
316 package_ensure => '10.1.14+maria-1~trusty',
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
317 bindings_enable => true,
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
318 }
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
319
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
320 # Dependency management. Only use that part if you are installing the repository as shown in the Preliminary step of this example.
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
321 Apt::Source['mariadb'] ~>
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
322 Class['apt::update'] ->
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
323 Class['::mysql::client']
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
324 ```
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
325
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
326 ### CentOSへのMySQL Communityサーバのインストール
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
327
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
328 MySQLモジュールおよびHieraを使用して、MySQL CommunityサーバーをCentOSにインストールすることができます。この例は以下のバージョンでテスト済みです。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
329
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
330 * MySQL Community Server 5.6
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
331 * Centos 7.3
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
332 * Hieraを使用したPuppet 3.8.7
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
333 * puppetlabs-mysqlモジュールv3.9.0
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
334
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
335 Puppetで:
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
336
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
337 ```puppet
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
338 include ::mysql::server
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
339
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
340 create_resources(yumrepo, hiera('yumrepo', {}))
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
341
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
342 Yumrepo['repo.mysql.com'] -> Anchor['mysql::server::start']
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
343 Yumrepo['repo.mysql.com'] -> Package['mysql_client']
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
344
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
345 create_resources(mysql::db, hiera('mysql::server::db', {}))
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
346 ```
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
347
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
348 Hieraで:
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
349
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
350 ```yaml
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
351 ---
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
352
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
353 # Centos 7.3
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
354 yumrepo:
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
355 'repo.mysql.com':
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
356 baseurl: "http://repo.mysql.com/yum/mysql-5.6-community/el/%{::operatingsystemmajrelease}/$basearch/"
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
357 descr: 'repo.mysql.com'
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
358 enabled: 1
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
359 gpgcheck: true
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
360 gpgkey: 'http://repo.mysql.com/RPM-GPG-KEY-mysql'
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
361
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
362 mysql::client::package_name: "mysql-community-client" # 適切なMySQL導入のために必要
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
363 mysql::server::package_name: "mysql-community-server" # 適切なMySQL導入のために必要
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
364 mysql::server::package_ensure: 'installed' # ここではバージョンを指定しないでください。残念ながら、パッケージがインストールされているエラーでyumは失敗しました。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
365 mysql::server::root_password: "change_me_i_am_insecure"
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
366 mysql::server::manage_config_file: true
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
367 mysql::server::service_name: 'mysqld' # Puppetモジュールに必要
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
368 mysql::server::override_options:
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
369 'mysqld':
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
370 'bind-address': '127.0.0.1'
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
371 'log-error': '/var/log/mysqld.log' # 適切なMySQL導入のために必要
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
372 'mysqld_safe':
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
373 'log-error': '/var/log/mysqld.log' # 適切なMySQL導入のために必要
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
374
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
375 # データベース+アクセスできるアカウント、暗号化されていないパスワードを作成
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
376 mysql::server::db:
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
377 "dev":
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
378 user: "dev"
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
379 password: "devpass"
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
380 host: "127.0.0.1"
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
381 grant:
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
382 - "ALL"
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
383
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
384 ```
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
385
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
386 ### プラグインのインストール
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
387
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
388 プラグインはユーザ定義のタイプ`mysql_plugin` を使用してインストールできます。`examples/mysql_plugin.pp`で、具体的な例を参照してください。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
389 ## リファレンス
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
390
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
391 ### クラス
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
392
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
393 #### パブリッククラス
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
394
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
395 * [`mysql::server`](#mysqlserver):MySQLをインストールして設定します。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
396 * [`mysql::server::monitor`](#mysqlservermonitor):モニタするユーザをセットアップします。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
397 * [`mysql::server::mysqltuner`](#mysqlservermysqltuner):MySQL tunerスクリプトをインストールします。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
398 * [`mysql::server::backup`](#mysqlserverbackup):cronを使用してMySQLバックアップをセットアップします。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
399 * [`mysql::bindings`](#mysqlbindings):さまざまなMySQL言語バインディングをインストールします。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
400 * [`mysql::client`](#mysqlclient):MySQLクライアントをインストールします(サーバ以外)。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
401
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
402 #### プライベートクラス
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
403
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
404 * `mysql::server::install`:パッケージをインストールします。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
405 * `mysql::server::installdb`:mysqldデータディレクトリ(/var/lib/mysqlなど)のセットアップを実行します。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
406 * `mysql::server::config`:MySQLを設定します。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
407 * `mysql::server::service`:サービスを管理します。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
408 * `mysql::server::account_security`:デフォルトのMySQLアカウントを削除します。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
409 * `mysql::server::root_password`:MySQLのルートパスワードを設定します。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
410 * `mysql::server::providers`:ユーザ、GRANT権限、データベースを作成します。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
411 * `mysql::bindings::client_dev`:MySQLクライアント開発パッケージをインストールします。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
412 * `mysql::bindings::daemon_dev`:MySQLデーモン開発パッケージをインストールします。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
413 * `mysql::bindings::java`:javaバインディングをインストールします。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
414 * `mysql::bindings::perl`:Perlバインディングをインストールします。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
415 * `mysql::bindings::php`:PHPバインディングをインストールします。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
416 * `mysql::bindings::python`:Pythonバインディングをインストールします。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
417 * `mysql::bindings::ruby`:Rubyバインディングをインストールします。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
418 * `mysql::client::install`:MySQLクライアントをインストールします。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
419 * `mysql::backup::mysqldump`:mysqldumpのバックアップを実行します。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
420 * `mysql::backup::mysqlbackup`:Oracle MySQL Enterprise Backupを使用してバックアップを実行します。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
421 * `mysql::backup::xtrabackup`:PerconaのXtraBackupを使用してバックアップを実行します。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
422
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
423 ### パラメータ
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
424
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
425 #### mysql::server
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
426
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
427 ##### `create_root_user`
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
428
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
429 ルートユーザを作成するかどうかを指定します。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
430
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
431 有効な値:`true`、`false`。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
432
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
433 デフォルト値:`true`。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
434
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
435 このパラメータは、Galeraでクラスタをセットアップする場合に役立ちます。ルートユーザの作成が必要なのは一度だけです。このパラメータを、1つのノードに対しtrueに設定し、他のすべてのノードに対してfalseに設定できます。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
436
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
437 ##### `create_root_my_cnf`
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
438
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
439 `/root/.my.cnf`を作成するかどうかを指定します。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
440
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
441 有効な値:`true`、`false`。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
442
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
443 デフォルト値:`true`。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
444
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
445 `create_root_my_cnf`を使用すると`create_root_user`に左右されずに`/root/.my.cnf`を作成できます。すべてのノードに`/root/.my.cnf`が存在するようにしたい場合に、Galeraでこの機能を使用してクラスタをセットアップできます。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
446
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
447 ##### `root_password`
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
448
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
449 MySQLのルートパスワード。Puppetは、このパラメータを使用して、ルートパスワードの設定や`/root/.my.cnf`の更新を試みます。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
450
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
451 `create_root_user`または`create_root_my_cnf`がtrueの場合にこのパラメータが必要です。`root_password`が'UNSET'の場合は`create_root_user`と`create_root_my_cnf`がfalseになります(MySQLルートユーザと`/root/.my.cnf`が作成されません)。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
452
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
453 パスワード変更はサポートされますが、`/root/.my.cnf`に旧パスワードが設定されている必要があります。実際には、Puppetは`/root/.my.cnf`に設定されている旧パスワードを使用してMySQLで新しいパスワードを設定してから、`/root/.my.cnf`を新しいパスワードで更新します。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
454
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
455 ##### `old_root_password`
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
456
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
457 現在、このパラメータでは何も行わず、下位互換性を確保するためだけに存在します。ルートパスワードの変更についての詳細は、上記の`root_password`パラメータの説明を参照してください。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
458
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
459 ##### `create_root_login_file`
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
460
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
461 mysql 5.6.6以上を使用するときに、`/root/.mylogin.cnf`を作成するかどうかを指定します。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
462
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
463 有効な値:`true`、`false`。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
464
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
465 デフォルト値:`false`。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
466
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
467 `create_root_login_file`は、既存の`.mylogin.cnf`のコピーを`/root/.mylogin.cnf`に作成します。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
468
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
469 このオプションを'true'に設定する場合、`login_file`オプションも指定する必要があります。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
470
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
471 'true'に設定する場合、`login_file`オプションが必要です。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
472
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
473 #### `login_file`
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
474
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
475 `/root/.mylogin.cnf`を規定の位置に配置するかどうかを指定します。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
476
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
477 `.mylogin.cnf`ファイルの作成には、`mysql_config_editor`を使用する必要があります。このツールは、mysql 5.6.6+に付属しています。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
478
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
479 作成した.mylogin.cnfファイルは、モジュール内のファイルの下に配置する必要があります。使用法については下記の例を参照してください。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
480
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
481 `/root/.mylogin.cnf`が存在する場合、環境変数`MYSQL_TEST_LOGIN_FILE`が設定されます。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
482
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
483 このパラメータは、`create_root_user`と`create_root_login_file`がどちらもtrueである場合に必要です。`root_password`が'UNSET'である場合、`create_root_user`および`create_root_login_file`はfalseであると見なされます。このため、MySQLのrootユーザと`/root/.mylogin.cnf`は作成されません。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
484
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
485 ```puppet
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
486 class { '::mysql::server':
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
487 root_password => 'password',
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
488 create_root_my_cnf => false,
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
489 create_root_login_file => true,
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
490 login_file => "puppet:///modules/${module_name}/mylogin.cnf",
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
491 }
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
492 ```
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
493
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
494 ##### `override_options`
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
495
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
496 MySQLに渡すオーバーライドオプションを指定します。構造はmy.cnfファイルのハッシュと同様です。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
497
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
498 ```puppet
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
499 class { 'mysql::server':
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
500 root_password => 'password'
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
501 }
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
502
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
503 mysql_plugin { 'auth_pam':
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
504 ensure => present,
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
505 soname => 'auth_pam.so',
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
506 }
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
507
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
508 ```
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
509
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
510 ### タスク
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
511
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
512 MySQLモジュールにはサンプルタスクがあり、ユーザはデータベースに対して任意のSQLを実行できます。[Puppet Enterpriseマニュアル](https://puppet.com/docs/pe/2017.3/orchestrator/running_tasks.html)または[Boltマニュアル](https://puppet.com/docs/bolt/latest/bolt.html)で、タスクを実行する方法に関する情報を参照してください。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
513
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
514 ## 制約事項
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
515
389
668df4711671 Update MySQL modules
IBBoard <dev@ibboard.co.uk>
parents: 244
diff changeset
516 サポートされているオペレーティングシステムの一覧については、[metadata.json](https://github.com/puppetlabs/puppetlabs-mysql/blob/main/metadata.json)を参照してください。
244
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
517
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
518 **注意:** mysqlbackup.shは、MySQL 5.7以降では動作せず、サポートされていません。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
519
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
520 ## 開発
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
521
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
522 Puppet Forge上のPuppetモジュールはオープンプロジェクトであり、その価値を維持するにはコミュニティからの貢献が欠かせません。Puppetが提供する膨大な数のプラットフォームや、無数のハードウェア、ソフトウェア、デプロイ設定に弊社がアクセスすることは不可能です。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
523
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
524 弊社は、できるだけ変更に貢献しやすくして、弊社のモジュールがユーザの環境で機能する状態を維持したいと考えています。弊社では、状況を把握できるよう、貢献者に従っていただくべきいくつかのガイドラインを設けています。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
525
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
526 弊社の詳細な[モジュール貢献についてのガイドライン](https://docs.puppetlabs.com/forge/contributing.html)をご確認ください。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
527
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
528 ### 作成者
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
529
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
530 このモジュールは、David Schmittが作成したものをベースにして、以下の作成者による貢献内容が加えられています(Puppet Labsを除く)。
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
531
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
532 * Larry Ludwig
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
533 * Christian G. Warden
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
534 * Daniel Black
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
535 * Justin Ellison
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
536 * Lowe Schmidt
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
537 * Matthias Pigulla
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
538 * William Van Hevelingen
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
539 * Michael Arnold
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
540 * Chris Weyl
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
541 * Daniël van Eeden
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
542 * Jan-Otto Kröpke
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
543 * Timothy Sven Nelson