You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert
ããæ°ã¶æãããåã«ãªããã© Rails (ActiveRecord) 㧠R/W splitting ãè¡ã switch_point ã¨ãã gem ãæ¸ããã Rails ã¢ããã°ã¬ã¼ãä½æ¥ã®ä¸ã§ãéæ¹é ããã acts_as_readonlyable ãã¡ã³ããããã¨ã«å«æ°ãããã¦ããã£ã¨ãã·ãªå®è£ æ¹æ³ãããã¯ãã¨æã£ã¦å¢ãã§ã³ã¢ã®å®è£ ããã¦ãããããå®éã®ã¢ããªã±ã¼ã·ã§ã³ã«çµã¿è¾¼ãã§æ¬çªã«æå ¥ãã¦ãããªããæ©è½è¿½å ããã°ä¿®æ£ãéãã¦ä»ã®å½¢ã«ãªã£ãã å æ¥ã® RubyKaigi 2014 ã® LT ã§ãR/W Splitting in Rails ã¨ããã¿ã¤ãã«ã§ switch_point ã®ç´¹ä»ãããã ä»ã¾ã§ä½¿ãæ¹ãçé¢ç®ã«æ¸ãã¦ãªãã£ããã©ãLT å ã§è»½ãç´¹ä»ãã¤ã¤ä¼æä¸ã«å ¸åçãªä½¿ãæ¹ã README ã«æ¸ãããã¡ã½ãããã¯ã©ã¹ã®ããã¥ã¡ã³ãã¯å ¨ç¶æ¸ãã¦ãªã (è¦ãã®ããªâ¦
â â åºè« 徳丸ããã®ã¹ã©ã¤ãããã¾ããèããªããã¹ã¯ã¼ãã®åãæ±ãæ¹ãã«è¦ãããããã«ãæ¨ä»ãã¦ã§ãã¢ããªã±ã¼ã·ã§ã³ã®è¨è¨è¦ä»¶ã¨ãã¦ããµã¼ãå ã«ä¾µå ¥ãããå ´åã§ãã¦ã¼ã¶ã¼ã®ãã¹ã¯ã¼ããã§ããã ãä¿è·ãã¹ãã¨ããè«èª¿ãè¦åããããããã«ãªã£ã¦ãã¾ããã ä¸æ²ã®ã¹ã©ã¤ãã§ã¯ããã®ææ³ã¨ãã¦ã½ã«ãã¤ãããã·ã¥åãå§ãã¦ãã¾ããããããªããã¹ã©ã¤ãã«æ¸ããã¦ããã¨ãããã½ã«ãã¤ãããã·ã¥ã«ã¯ãè¤éãªãã¹ã¯ã¼ãã®è§£èªã¯å°é£ã«ãªããã®ã®ãåç´ãªãã¹ã¯ã¼ããè¨å®ãã¦ãã¾ã£ã¦ããã¦ã¼ã¶ã¼ã®ãã¹ã¯ã¼ãã«ã¤ãã¦ã¯ååãªä¿è·ãæä¾ã§ããªãã¨ããåé¡ãããã¾ããããã¦ãå¤ãã®ã¦ã¼ã¶ã¼ã¯é©åãªãã¹ã¯ã¼ãéç¨ãã§ããªããã¨ããã®ãæ²ããç¾å®ã§ãã ã½ã«ãã¤ãããã·ã¥ã使ã£ãææ³ã§ãã®ãããªåé¡ãæ®ãã®ã¯ãã¦ã§ãã¢ããªã±ã¼ã·ã§ã³ãµã¼ãã«ä¾µå ¥ããæ»æè ãã¦ã¼ã¶ã¼ã®èªè¨¼æ å ±ããã¦ã³ãã¼ããã¦ãèªè¨¼æ å ±ããªãã©ã¤ã³æ»æããã
(2014.12.3追è¨ï¼ãã®blogã®å 容ã¯ã以ä¸ã®æ¸ç±ã«ãåæ ãããã) SQLã¬ãã«ã®å·®ç° MariaDB5.5ã¨MySQL5.5ã§ã¯SQLã¬ãã«ã§ã®éãã¯ã»ã¨ãã©ãªãã£ããautoincrementã®æ大å¤ã®æ±ããããã ãã ããMariaDB10.0ã§REGEXPããã«ããã¤ã対å¿ã«ãªã£ãã®ã§ãã¢ããªå´ã¯æ³¨æã é ç® MySQL MariaDB Autoincrement æ大å¤ã«éããã¨ã以éã¯æ大å¤ãç¹°ãè¿ããWarningã®ã¿ãã¨ã©ã¼ã«ãªããªããtinyintãªãâ¦,125,126,127,127,127⦠æ大å¤-1ã¾ã§ã以éã¯ã¨ã©ã¼ãè¿ããtinyintãªãâ¦,125,126,ERROR,ERROR,⦠EXPLAINæ JSONå½¢å¼ ãã¼ã¸ã§ã³5.6ãã æªå¯¾å¿ Optimizer Trace ãã¼ã¸ã§ã³5.6ãã æªå¯¾å¿ï¼ãã ããMariaDBã®ã»ãããªããã£ãã¤ã¶
横æçã«DBæä½ã®é¡ä¼¼ã³ãã³ããæ¢ãããã®ãµã¤ã ä¾ãã° MySQL ãç¥ã£ã¦ãã人ã æ°ããä»ã®ãã¼ã¿ãã¼ã¹ãä¾ãã° Oracle ãå¦ç¿ããéã« MySQL ã§ããã¨ããã®ã¢ã¬ã¯ Oracle ã§ã¯ã©ãããã³ãã³ããªãã ãã ã¨ããæãã«æ å ±ãæ¢ãå ´é¢ãå¤ãããã¾ãã ããããé¡ã®æ å ±ãæ¢ãã¨ãã«å½¹ã«ç«ã¡ãããªãªãã¡ã¬ã³ã¹ãµã¤ããä½ãã¾ããã xref.jp xref.jp - Database 追è¨: ã³ã³ãã³ãå¢ããã¾ãã yum, apt-get, rpm çã ã®æ¨ªææ¯è¼ãªãã¡ã¬ã³ã¹ - clock-up-blog ã½ã¼ã¹ã³ã¼ã GitHub ã«ä¸ãã¦ããã®ã§èå³ãã人ã¯è¦ã¦ã¿ãã¨è¯ãã§ãã kobake/xref.jp · GitHub PHP ã§æ¸ãã¦ã¾ããããããæ±ãã§ããè¬éãããªãã¦æ¬å½ã«ã ãã«ãªã¯æè¿ã æ©è½ ãããªã¯ã¹æ¹åã®åæ¿ æ¯è¼è¡¨ã®è¦åºãã®åãã£ã¦ããã®çµã¿
DBã¨ã³ã¸ãã¢ã®ããã®æè¡åå¼·ä¼ï¼ç¬¬3åï¼ã§ä½¿ç¨ããè³æã§ãã主ã«ãªã¬ã¼ã·ã§ãã«ã¢ãã«ã¨æ£è¦åã«ã¤ãã¦è§£èª¬ãã¦ãã¾ãããªã¬ã¼ã·ã§ãã«ã¢ãã«ã®éçã«ã¤ãã¦æ£ããèªèãã¦ããããªã¬ã¼ã·ã§ãã«ã¢ãã«ãç解ããã¨è¨ããã¨æãã¾ãã
ç£è¨³ã®ä¸äººã§ãã @t_wada ã«ç®æ¬é ãã¾ããã ãããã¨ããããã¾ãï¼ï¼ï¼ ã§ã ããããªãã ãã©ã³ã¬ãã¿ã¤ãã«ã§æãã¦ãã¨æããã ããâ¦â¦ ã ã£ã¦ãSQL ã®ã¢ã³ããã¿ã¼ã³ã¦ã¿ã¤ãã«ã ã£ããã join ããçµæã®æ¹ã§ where ã§çµãããã on å¥ã§å ã«çµã çãªã®ãæ¸ãã¦ããã¨æããããï¼ï¼ åãåããè¨èªã®äºã ã¨æããããï¼ï¼ï¼ éã£ãâ¦â¦ ã»ã¨ãã©æ¸ãã¦ããã®ã¯ DB è¨è¨ã«ã¤ãã¦ã ã£ãâ¦â¦ ã¾ããå¯é¡ã¯ãAvoiding the Pitfalls of Database Programmingãã®ã ããã¾ããããã ãã§ãèªãã§ã¿ãææ³ã¨ã ããããä½å¹´ã DB 絡ãã éçºãããã¨ã®ãã人ãªãï¼ã»âã»ï¼ï¾ï¾ï¾ï¾åºæ¥ãã¨æãã ãâãã«ãã«ã©ã ã¢ããªãã¥ã¼ãâã¨ã 10 å¹´åã«éã£ããã¼ã ã¨ã ããã¼ã¯ãã¯ãâã¤ã³ããã¯ã¹ã·ã§ããã¬ã³âä¹ã ã¿ãããªã Explain
MySQL | PostgreSQL | MongoDB | Redis Works with AWS, Linode, DigitalOcean, Rackspace, Heroku and more. Automatic daily backup to Amazon S3. Review your backup strategy Replication and RAID aren't a backup. What happens if your database is wiped by a developer by mistake, or taken hostage by an attacker? You have a virtual machine snapshot, but what happens when a wrong instance was dropped? What a
ãã¼ã¿ãã¼ã¹è¨è¨ã®è©±ããã¦ãã¦ããé£çªã®ä¸»ãã¼ã¯æ¥åä¸æå³ã®ãªããã¼ã¿ã ããããã¼ãã«ã«æãããã®ã¯ã ãã ãè¤å主ãã¼ã«ããã¹ããã¨ããæè¦ãèãæ©ä¼ãããã¾ããã èé«åå°ã§ããªããã¼ãã¨æã£ããã®ã®ãçç±ãä¸æã説æã§ããªãã£ãã®ã§ãæ¹ãã¦èãã¦ã¿ã¾ããã ãã®çµæã次ã®ãããªçµè«ã«è³ãã¾ããã åä¸ã®é£çªã«ã©ã ã«ãã主ãã¼ã¨ãè¤åã«ã©ã ã«ãã主ãã¼ã¨ã§è¿·ã£ãã å®è£ ãã·ã³ãã«ã«ããæ¥åå¤æ´ã®å½±é¿ç¯å²ãå°ããããããã«ãè¤å主ãã¼ãé¿ãã ã¨ããããã§ã調ã¹ããã¨ãèãããã¨ãã¡ã¢ãã¦ããã¾ãã# ééã£ã¦ããé¨åãããã°ãæãã¦ããã ããã¨å¬ããã§ãã ï¼2011/07/25 追è¨ï¼è¤å主ãã¼ã¨ãµãã²ã¼ããã¼ã«ã¤ãã¦ã¯ãè¦ä»¶ãã·ã¹ãã ã«ä¾åãã¦å¤æ§ãªå¤æãããããã¨æãã¾ããã«ããããããããé¿ããã¹ããã¨ããã¿ã¤ãã«ã«ããã®ã¯æ¥µç«¯ã§ãããç³ã訳ããã¾ããããææä¸ãã£ãçããããã
ã¹ãã¼ãã¼ãºã§ rails ã使ã£ã¦å§ãã¦ä½ã£ãã¢ããªã±ã¼ã·ã§ã³ã¯ã 社å ç¨ã®ç°¡åãªå°±æ¥ç®¡çã·ã¹ãã ãªã®ã§ããã1å¹´åã«éçºãããã®ã§å½æ㯠mysql 㨠rails ã®æåã³ã¼ãå¨ãã®è¨å®ãææ§ãªã¾ã¾éçºãã¦ããããã ãã¼ãã«ã® charset 㯠latin1 ã ã£ãããã¾ãã rails çµç±ã§ãã¼ã¿ãè¦ãå ´åã¯åé¡ãªãã®ã§ãããMySQL Administrator ã phpMyAdmin ã§ãã¼ã¿ãè¦ãã¨ã è¦äºã«æååããã¦ãã¾ãã ããã§ä»åçµæ§å¤§ããªæ©è½ã¢ãããããã¿ã¤ãã³ã°ã§æ¢åãã¼ã¿ã utf8 ã«å¤æãã¦ãã¾ããã¨ã«ãã¾ããã ã¾ã latin1 㧠hoge_production ãã¼ã¿ãã¼ã¹ãããã¼ã¿ããã³ããã¾ãã # mysqldump --default-character-set=latin1 hoge_production > ./db_dump.
Objecttank@rubyã®DBã¢ã¯ã»ã¹ã©ã¤ãã©ãªãDBIããSequelã«ç§»è¡ä¸ãSequelã®åèãã¼ã¸http://sequel.rubyforge.org/http://www.slideshare.net/zhesto/ruby-off-rails-japanesehttp://xxx.mostevildanceclassics.com/page/r/SequelRubyã¤ã³ã¹ãã¼ã« sudo gem install sequel ã¨ããããå®è¡sequelã®ã³ãã³ãã©ã¤ã³ãã¼ã«ãrailsã®script/consoleã®ãããªãã®ã sequel mysql://user:password@localhost/dbname DBã¨ããååã®å¤æ°ã«æ¥ç¶ãªãã¸ã§ã¯ããæ ¼ç´ããããã¼ãã«å=userããã£ãã¨ããã¨ããã DB[:user].filter(:id => 10).a
[English] ãã㯠MySQL ã® Ruby API ã§ããMySQL ã® C API ã¨ã»ã¼åçã®æ©è½ãããã¾ãã ãã¦ã³ãã¼ã RubyForge tmtm.org å¿ è¦ãªãã® MySQL 5.0.67 Ruby 1.8.7, 1.9.1 ããã以å¤ã§ã make ã§ããããããã¾ãããã確èªãã¦ã¾ããã ã©ã¤ã»ã³ã¹ ãã®ããã°ã©ã 㯠Ruby ã©ã¤ã»ã³ã¹ ã«å¾ãã¾ãã ã¤ã³ã¹ãã¼ã« 次ãå®è¡ãã¦ãã ããã % ruby extconf.rb ã¾ã㯠% ruby extconf.rb --with-mysql-dir=/usr/local/mysql ã¾ã㯠% ruby extconf.rb --with-mysql-config ãããã % make extconf.rb ã«ã¯æ¬¡ã®ãªãã·ã§ã³ãæå®ã§ãã¾ãã --with-mysql-include=dir MySQL
Sequel provides thread safety, connection pooling and a concise DSL for constructing database queries and table schemas. Sequel also includes a lightweight but comprehensive ORM layer for mapping records to Ruby objects and handling associated records. Sequel supports advanced database features such as prepared statements, bound variables, stored procedures, master/slave configurations, and databa
Ruby Sequel is a lightweight database toolkit for Ruby.Sequel provides thread safety, connection pooling and a concise DSL for constructing database queries and table schemas. Sequel also includes a lightweight but comprehensive ORM layer for mapping records to Ruby objects and handling associated records. Sequel supports advanced database features such as prepared statements, bound variables, mas
MYSQLã®ã¦ã¼ã¶é¢é£ã³ãã³ãã®ã¤ãã¦ç´¹ä»ãã¦ãã¾ãã [toc] ã¦ã¼ã¶ã®ä½æ ã¦ã¼ã¶åã¯åè§è±æ°ã®16æåã¾ã§ã§ãã æ§æ GRANT権é ON *.* TO ã¦ã¼ã¶å IDENTIFIED BY 'ãã¹ã¯ã¼ã'ãWITH GRANT OPTION; å ¨ã¦ã®æ¨©éãä¸ããå ´å ALL PRIVILEGESããããããããï¼å ¨ã¦ã®æ¨©éãä¸ãã WITH GRANT OPTIONãããã ï¼æ¨©éã®æ¸ãæãã許å¯ãã 使ç¨ä¾ mysql> GRANT ALL PRIVILEGES ON *.* TO sasuke IDENTIFIED BY 'aaa' WITH GRANT OPTION; Query OK, 0 rows affected (0.03 sec) ä¸é¨æ¨©éãSELECT,INSERTã®ã¿ä¸ããå ´å 使ç¨ä¾ mysql> GRANT INSERT,SELECT ON *.* TO
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}