Skip to content

Instantly share code, notes, and snippets.

View rust's full-sized avatar
🏠
Working from home

Shinichiro OGAWA rust

🏠
Working from home
View GitHub Profile
require 'tokyocabinet'
include TokyoCabinet
# create the object
hdb = HDB::new
# open the database
if(!hdb.open("casket.hdb", HDB::OWRITER | HDB::OCREAT))
ecode = hdb.ecode
STDERR.printf("open error: %s\n", hdb.errmsg(ecode))
require 'tokyotyrant'
include TokyoTyrant
# create the object
rdb = RDB::new
# connect to the server
if !rdb.open("localhost", 1978)
ecode = rdb.ecode
STDERR.printf("open error: %s\n", rdb.errmsg(ecode))
require 'benchmark'
require 'tokyocabinet'
require 'digest/sha1'
require 'pp'
bdb = TokyoCabinet::BDB.new
unless bdb.open("dbd-benchmark.dbd", TokyoCabinet::BDB::OWRITER | TokyoCabinet::BDB::OCREAT)
exit
end
class User < ActiveRecord::Base
def access_time=(time = Time.now)
raise "#{self.class} isn't saved." unless id
access_log = UserAccessLog.find(id)
access_log.time = time
access_log.save
end
def access_time
require 'tokyotyrant'
class UserAccessLog
@@connection = {:master => nil, :slave => nil}
@@tt_server = {
:master => {
:host => "localhost",
:port => "1978",
},
:slave => {
class Flare
# limit value size
MAX_VALUE_SIZE = 10_000_000
# connections
@@connection = {
:writer => nil,
:reader => nil
}
@@flare_saver = nil
#
# drbd.conf example
#
# parameters you _need_ to change are the hostname, device, disk,
# meta-disk, address and port in the "on <hostname> {}" sections.
#
# you ought to know about the protocol, and the various timeouts.
#
# you probably want to set the rate in the syncer sections
#
# drbd.conf example
#
# parameters you _need_ to change are the hostname, device, disk,
# meta-disk, address and port in the "on <hostname> {}" sections.
#
# you ought to know about the protocol, and the various timeouts.
#
# you probably want to set the rate in the syncer sections
<?xml version="1.0"?>
<cluster name="mycluster" config_version="1">
<clusternodes>
<clusternode name="centos-primary" votes="1" nodeid="1">
<fence>
<method name="single">
<device name="manual" ipaddr="192.168.100.101"/>
</method>
</fence>
</clusternode>
# This is an example configuration file for the LVM2 system.
# It contains the default settings that would be used if there was no
# /etc/lvm/lvm.conf file.
#
# Refer to 'man lvm.conf' for further information including the file layout.
#
# To put this file in a different directory and override /etc/lvm set
# the environment variable LVM_SYSTEM_DIR before running the tools.