1

2 つの MYSQL サーバーをセットアップしました。

my.cnf サーバー 1:

auto_increment_increment = 2
auto_increment_offset = 1 

my.cnf サーバー 2:

auto_increment_increment = 2
auto_increment_offset = 2 

しかし、異なるサーバーからレコードを 1 つずつ 10 回挿入すると、次のようになります。

INSERT INTO `table1` (`id`, `text`) VALUES (NULL, '22222');

結果:

id  text
1   22222
2   22222
5   22222
6   22222
9   22222
...

しかし、私はしたい:

id  text
1   22222
2   22222
3   22222
4   22222
5   22222
...

可能です?

4

1 に答える 1

-1

この理由の一部として、挿入が別のセッションから呼び出されることが考えられます。auto_increment_increment = 2 の場合、私の推測では、おそらく目的の結果が得られないでしょう。auto_increment_increment と auto_increment_offset の両方を 1 に設定してみましたか?

于 2013-09-23T23:51:18.740 に答える