Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@thhermansen
Created June 5, 2011 10:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thhermansen/1008858 to your computer and use it in GitHub Desktop.
Save thhermansen/1008858 to your computer and use it in GitHub Desktop.
Hbase site configuration file
class Car < MassiveRecord::ORM::Table
# Defines a column family "info" where two fields are stored.
# By default fields will be strings, but you can send in a type
# As a second option, for instance :integer, :boolean and so on.
# You can also set a default value, and say that a field can't be nil or not.
# For more information, see MassiveRecord's github page.
column_family :info do
field :brand
field :color
end
end
ruby-1.9.2-p180 :002 > Car.all
=> []
ruby-1.9.2-p180 :003 > car = Car.new(:brand => 'Nissan Leaf', :color => 'blue')
=> #<Car id: "1", brand: "Nissan Leaf", color: "blue", updated_at: nil>
ruby-1.9.2-p180 :004 > car.save!
=> true
ruby-1.9.2-p180 :005 > Car.all
=> [#<Car id: "1", brand: "Nissan Leaf", color: "blue", updated_at: "2011-06-09 21:19:46 +0200">]
ruby-1.9.2-p180 :006 > Car.first
=> #<Car id: "1", brand: "Nissan Leaf", color: "blue", updated_at: "2011-06-09 21:19:46 +0200">
ruby-1.9.2-p180 :007 > Car.find("1")
=> #<Car id: "1", brand: "Nissan Leaf", color: "blue", updated_at: "2011-06-09 21:19:46 +0200">
ruby-1.9.2-p180 :008 > Car.find("not-here")
MassiveRecord::ORM::RecordNotFound: Could not find Car with id=not-here
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--
/**
* Copyright 2010 The Apache Software Foundation
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<configuration>
<property>
<name>hbase.rootdir</name>
<value>file:///usr/local/Cellar/hbase/databases/hbase-${user.name}/hbase</value>
<description>The directory shared by region servers and into
which HBase persists. The URL should be 'fully-qualified'
to include the filesystem scheme. For example, to specify the
HDFS directory '/hbase' where the HDFS instance's namenode is
running at namenode.example.org on port 9000, set this value to:
hdfs://namenode.example.org:9000/hbase. By default HBase writes
into /tmp. Change this configuration else all data will be lost
on machine restart.
</description>
</property>
</configuration>
defaults: &defaults
host: 127.0.0.1
port: 9090
development:
<<: *defaults
test:
<<: *defaults
production:
<<: *defaults
#
# Just to name space tables. You don't have to do this of course.
#
MassiveRecord::ORM::Base.table_name_suffix = "_#{Rails.env}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment