5.7からだよ。。labs.mysql.com■How does it work?・Now we have the concept of communication channels. Each communication channel is a connection from slave to master to get the binary log events. That means we will have one IO_THREAD for each communication channel. We will need to run different “CHANGE MASTER” commands, one for each master, with the “FOR CHANNEL” argument that we will use to give a name to that channel==>CHANGE MASTER MASTER_HOST='something', MASTER_USER=... FOR CHANNEL="name_of_channel1";CHANGE MASTER MASTER_HOST='something', MASTER_USER=......
2014/04/23
mysql binlog_row_image
In MySQL row-based replication, each row change event contains two images, a “before” image whose columns are matched against when searching for the row to be updated, and an “after” image containing the changes. Normally, MySQL logs full rows (that is, all columns) for both the before and after images. However, it is not strictly necessary to include every column in both images, and we can often save disk, memory, and network usage by logging only those columns which are actually required. For the before image, it is necessary only that the minimum...
mysql GTID replication 考え方
Global Transaction IDGTID = source_id:transaction_idsource_id==>the originating server. Normally, the server's server_uuid is used for this purposetransaction_id==>a sequence number determined by the order in which the transaction was committed on this server■A global transaction identifier (GTID) is a unique identifier created and associated with each transaction when it is committed on the server of origin (master). This identifier is unique not only to the server on which it originated, but is unique across all servers in a given replication...
mysql Crash-safe Replication
■A common request is to have replication crash-safe in the sense that the replication progress information always is in sync with what has actually been applied to the database, even in the event of a crash. Although transactions are not lost if the server crashes, it could require some tweaking to bring the slaves up again.=>リアルの情報を覚えなぁきゃ。。in the latest MySQL 5.6 milestone development release, the replication team has implemented crash-safety for the slave by adding the ability of committing the replication information together with the transaction...
Mysql Replication Event Checksum
Since the checksums are added to all events in the binary log on the master and transfered both over the network and written to the relay log on the slave, it is possible to track events corrupted events both because of hardware problems, network failures, and software bugs.-->チェックする仕組みを入れた。The checksum used is a CRC-32 checksum, more precisely ISO-3309, which is the one supplied with zlib. ==>特に気にしなくて...
mysql GTID replication セットアップ
■cold start
1If replication is already running, synchronize both servers by making them read-only.
=>SET @@global.read_only = ON;
2Stop both servers.
=>mysqladmin -uusername -p shutdown
3Restart both servers with GTIDs, binary logging, and slave update logging enabled, and with statements that are unsafe for GTID-based replication disabled. In addition, the servers should be started in read-only mode, and the slave SQL and I/O threads should be prevented from starting on the slave.
=>mysqld_safe --gtid_mode=ON --log-bin --log-slave-updates ...
mysql multi-threaded slaves
■
Here are three key variables that you need to set to achieve maximum performance with multi-threaded slaves:
binlog-format=STATEMENT
relay-log-info-repository=TABLE
master-info-repository=TABLE
he variable slave_parallel_workers should be set to equal the number of schemas that you have
■うん。。
MySQLのレプリケーションを担当しているスレッドは、IOスレッドとSQLスレッドの2つだった。IOスレッドがマスタからバイナリログをとってきて、SQLスレッドがバイナリログ内に記録されたSQL文を実行しデータを反映していくのが従来の動作だった。新しいマルチスレッドレプリケーションでは、このIOスレッドとSQLスレッドの間に新しくSQLスレッドコーディネータを置く。
さらにSQLスレッドは、workerとして複数のスレッドに分割される。SQLスレッドコーディネータはSQLスレッドからバイナリログを受け取り、どのデータベースに対する更新なのかを判断して、それぞれのデータベースを担当するworkerに振り分ける。workerは受け取ったSQLを実行し、データベースを更新していく。
Interaction...
2014/04/18
2014/04/18
play framework 考える方
■full-stack? framework
Being ‘full-stack’ is not just a question of functionality, which may already
exist as a collection of open-source libraries. After all, what’s the point of a
framework if these libraries already exist and already provide everything you need
to build an application? The difference is that a full-stack framework also provides
a documented pattern for using separate libraries together in a certain way, and
therefore confidence that a developer can make the separate components work
together. Without this, you never know whether...
2014/04/16
mysql delete truncate
★テーブルに含まれる全データを削除する場合:TRUNCATE TABLE tbl_name;DELETE FROM tbl_name;★2つの違いは「DELETE FROM tbl_name」がデータを1つ1つ削除するのに対して「TRUNCATE TABLE tbl_name」はいったん「DROP TABLE tbl_name」を行った上で再度同じテーブルを作成する点にある・データを1つ1つ削除するよりもテーブルそのものを削除して作り直すほうが多くの場合高速・AUTO_INCREMENTのクリア。・テーブルがInnoDB型の場合で、外部参照の親テーブルとなっている場合には「TRUNCATE TABLE tbl_name」を実行すると「DELETE FROM tbl_name」を使ってデータの削除が行われます。この場合、子テーブルにおいてON DELETE句が呼び出されます。MyISAM型の場合にはテーブルの削除を使ってデータが削除されるためて子テーブルのON DELETE句は呼び出されません。AUTO_INCREMENTが設定されているカラムが含まれていた場合、TRUNCATE文を使って全データの削除が行われるとAUTO_INCREMENTの値が初期化されます。これはInnoDB型で外部参照の親テーブルとなっている場合も同じように初期化されます。...
Linux シグナル
プロセスが止まらないとき,キーボードから Control-C を打鍵して止めることがよくある。 何もプログラムに Control-C の入力を処理するコードを書いたわけではないのに止まる。 なぜ止まるのだろう。 ==>シグナル計算機の CPU はさまざまなハードウェアからの割り込み要求 (interrupt request) を非同期的に受け付ける。シグナルとは,このような CPU へのハードウェア的な割り込み要求に似た仕組みを,オペレーティング・システムがソフトウェア的に実現したものである。 ハードウェアの割り込み要求が CPU へと送られるのと同じように,シグナルはプロセスへと送られる。つまり,シグナルとは,プロセスに送られるソフトウェア的な割り込み要求である。 1 SIGHUP 制御端末(controlling terminal)のハングアップ検出、または制御しているプロセスの死2 SIGINT キーボードからの割り込み (Interrupt)3 SIGQUIT ...
mysql shutdown
■support by any Platform: mysqladmin shutdown・if shutdown was requested by a client,a shutdown thread is created.・shutdown is the result of receiving a SIGTERM signal, the signal thread might handle shutdown itself■The server stops accepting new connections.To prevent new activity from being initiated during shutdown, the server stops accepting newclient connections by closing the handlers for the network interfaces to which it normally listens forconnections: the TCP/IP port, the Unix socket file, the Windows named pipe, and...
httpd mod_rewrite
■mod_rewrite は Apache の機能であり、モジュールを組み込むことで利用できる。
URL(ドメイン以下のパス)のリダイレクトや偽装、置き換えなどが行える。
一般的な正規表現を利用して RewriteRule を書くことができる。
・mod_rewrite.so
・httpd.conf にLoadModule rewrite_module modules/mod_rewrite.so
■RewriteCond
「RewriteCond」は、RewriteRule を実行するための条件を定義するための記述です。
RewriteCond に記述した条件が満たされた時のみ RewriteRule に書いたURLの書き換えと転送が実行されるようにできます。
RewriteCond は、RewriteRule の記述部の前に複数個記述することができます。 RewriteCond を複数記述した場合には、複数の条件が全て一致した場合に RewriteRule を実行するのか(AND)、複数の条件のいずれかが一致した場合に実行するのか(OR) も指定することができます。
RewriteCond %変数名(テスト文字列) 条件パターン(正規表現) [フラグ]
RewriteCond...
2014/04/05
2014/04/05
dcom server process launcher
DCOM Process Launcher
サービスが無効になっていると、Windows XP Service Pack 2、Windows XP Professional x64
Edition、Windows Server 2003 SP1、および x64 ベースの Windows Server 2003 で
Windows ファイアウォール サービスを開始できない
...
2014/04/03
mysql skip-slave-startオプションについて
★いろんな場面で保険をかけるの意味で、リプレケーションを後にする時。mysqldを起動したとき、自動的にslave startしているようだ。mysql> show processlist;+----+-------------+-----------+------+---------+------+-----------------------------------------------------------------------+------------------+| Id | User | Host | db | Command | Time | State ...
ansible ループ 条件分岐
・単純ループ: name: add several users user: name={{ item }} state=present groups=wheel with_items: - testuser1 - testuser2・with_items + 辞書によるループ name: add several users user: name={{ item.name }} state=present groups={{ item.groups }} with_items: - { name: 'testuser1', groups: 'wheel' } - { name: 'testuser2', groups: 'root' }・コマンド実行結果を with_items で回すーー>かなり動的に- name: retrieve the list of home directories command: ls /home register: home_dirs -...
mysql restore view 失敗
* DEFINERで指定したユーザーが存在して、検索対象のビューが参照しているテーブルの閲覧権限を持っていない場合ERROR 1356 (HY000): View 'faa.view_aa' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them ■MySQLでViewを使うときに注意することMySQL 5系からViewが利用可能となりました。そんなView機能を利用していて、ネットワーク構成が変更になった場合には気をつけておかなければならないことがあります。それは、DEFINER節とSQL SECURITY節についてです。この2つの節の説明は以下のように述べられています。 DEFINER節およびSQL SECURITY節はビューの呼び出しにおいて、アクセス権限をチェックするとき使用すべきセキュリティーコンテキストを規定します。CREATE ALGORITHM=UNDEFINED DEFINER=`test`@`a-b-c.d.e` SQL SECURITY...
linux scp sudo 権限
scpで権限問題でうまくいかない。scp -r -p aaa host1:/home/test/..-->permission denied下記のようにできた。転送先で仮の権限あるフォルダを作成するsudo scp -r -p -i /home/test/.ssh/id_rsa test@host1:/home/test/tmpscp -r -p test@host1:/home/test/...
linux 空ディレクトリだけを削除する
findには-emptyなんてオプションがあった$ find . -type d -emptyしかも-deleteなんてオプションもあった$ find . -type d -empty -del...
2014/04/03
OAuth2.0
requestTokenaccessTokenユーザの視点:大きな特徴は3つです。・HTTPSを必須にし、署名をなくし、トークン取得も簡略化・アクセストークンのみでリソース取得が可能に・Webアプリも含め、4つのクライアントプロファイルを仕様化開発の視点:accessTokenの獲得は目的で、各webサビースはこのaccessTokenを発行するために、こちらの物を登録する必要がある。登録して「appKey,appId」を獲得する。登録してそこで管理される。他のいろんなレベル制限がある。サービスにより、非常の不自由なところがある。特定なURLをアクセスして、accessTokenを獲得する。そして、このaccessTokenは有効期限もある。後はいろんなクライアントがある。facebook4j,twitter4jなど...
windows shutdown command task
★shutdownコマンドには、リモートのコンピュータの電源を管理するものなど、以下の表のようなオプションがある。
--------------------
オプション 機能
-i GUIインターフェイスを表示する。GUIインターフェイスでのデフォルト・タイムアウトは20秒である
-l ログオフする
-s シャットダウン(電源オフ)する
-r 再起動する
-a shutdown実行の中止(Abort)
-m \\コンピュータ名 リモート・コンピュータにログオフ/電源オフ/再起動を指示する。ログオフ(-l)オプションとは併用できない
-t xx 処理開始までのタイムアウトをxx秒で指定する。デフォルトは30秒
-c "コメント" イベントログに書き込まれるコメントを記入する
-f 実行中のプロセスを警告なしで閉じる
-d...
2014/04/03
jmeter 全てのイメージとアプレットを繰り返し
サンプラでHTTPリクエストをするとき、デフォルトだとそのページのHTMLしかダウンロードしてくれません。これだとHTML内の画像やCSS、JavaScriptファイルがダウンロードされず、十分な負荷をかけていると言えなくなります。これをエミュレートするには、サンプラの下のほうの「すべてのイメージとアプレットを繰り返しダウンロードする (HTMLファイルのみ)」という謎のオプションにチェックを入れます。この説明だけだとまるで画像とアプレットしかダウンロードしてくれないように思いますよね。調べてみると、これは日本語訳が悪いようで、英語を見ると「Retrieve All Embedded Resources from HTML File」と書いてありました。単純にHTMLファイルをパースして添付されてるファイルをダウンロードするようです。ただ、このオプションには現実に沿っていない計測仕様があるようです。詳しくは以下のリンクを。あるECサイトにかかるストレスとスループットの測定のために、HTTPサンプラーの「すべてのイメージとアプレットを繰り返しダウンロードする」という機能を使って、ページとページ内の画像やCSS丸ごとを1ページビュー(PV)としてログインから商品購入までのシナリオを流しているのですが、なんだかすごく遅いんです。商品画面を1ページ表示するのに1分以上かかったりすることがあります。★★★2009-09-18サーバのアクセスログをみながら原因を探していると、JMeterがページ内の画像やCSSをダウンロードしている部分に時間がかかっていることが判明しました。Retrieve...
2014/04/03
CDN
CDN(Contents Delivery Network)は、コンテンツ配信などを行うサイト運営側がエンドユーザーに対して効率よく安定して提供するネットワークのことを指します。サイト運営側のサーバーへ直接アクセスする場合、事前に想定しているより多くのアクセスが行われると、サーバーへの負荷が増大し、場合によってはサーバーがダウンすることがあります。そこでサイト運営側はその解決策の1つとしてCDNを利用します。CDNの仕組みは次の通りです。サイト運営側は、サーバーのコンテンツ(サイトを構成するhtmlや、画像、映像、音楽といったデジタルコンテンツなど)と同期をとっているサーバー(以下、キャッシュサーバー)を複数台用意します。これによりエンドユーザーからのアクセスをサイト運営側のサーバーからキャッシュサーバーに振り分けることで、アクセスを分散させ...