Centos6.5里安装Erlang 并安装riak
2015-08-22 02:13
776 查看
一.Erlang安装:
1 首先进入www.erlang.org 下载页面,下载otp_src_17.5.tar.gz. IT网,http://www.it.net.cn
2 解压缩:tar -xzvf otp_src_17.5.tar.gz Linux学习,http:// linux.it.net.cn
3 进入解压缩后的文件夹:cd otp_src_17.5.tar.gz
4 如果直接运行./configure,会提示没有curses库,所以首先还得安装这个库:yum install ncurses-devel,运行此命令需要具备root权限。
5 运行./congigure命令。
6 运行make命令。
7 运行make install命令。
安装成功后,在命令行输入erl,则erlang shell便会运行起来。至此,安装完全成功。
yum install gcc
riak安装:
http://docs.basho.com/riak/1.3.2/tutorials/installation/Installing-on-RHEL-and-CentOS/
备注:(不知道有什么卵用)
View Code
1 首先进入www.erlang.org 下载页面,下载otp_src_17.5.tar.gz. IT网,http://www.it.net.cn
2 解压缩:tar -xzvf otp_src_17.5.tar.gz Linux学习,http:// linux.it.net.cn
3 进入解压缩后的文件夹:cd otp_src_17.5.tar.gz
4 如果直接运行./configure,会提示没有curses库,所以首先还得安装这个库:yum install ncurses-devel,运行此命令需要具备root权限。
5 运行./congigure命令。
6 运行make命令。
7 运行make install命令。
安装成功后,在命令行输入erl,则erlang shell便会运行起来。至此,安装完全成功。
yum install gcc
riak安装:
http://docs.basho.com/riak/1.3.2/tutorials/installation/Installing-on-RHEL-and-CentOS/
备注:(不知道有什么卵用)
package com.demo; import java.io.IOException; import com.basho.riak.client.IRiakClient; import com.basho.riak.client.RiakException; import com.basho.riak.client.RiakFactory; import com.basho.riak.client.RiakRetryFailedException; import com.basho.riak.client.bucket.Bucket; public class ClientTest { public static void main(String[] args) throws IOException { IRiakClient client = null; try {// 使用pbc方式连接,而不是http,在/etc/riak/app.config client = RiakFactory.pbcClient("192.168.1.111", 8087); } catch (RiakException e) { e.printStackTrace(); } // 显示. System.out.println(client); Bucket myBucket = null; String bucketName = "userInfo"; try { myBucket = client.fetchBucket(bucketName).execute(); if (myBucket == null) { myBucket = client.createBucket(bucketName).execute(); } } catch (RiakRetryFailedException e) { e.printStackTrace(); } // ################保存数据 . UserInfo info = new UserInfo(); info.setUid("001"); info.setName("张三"); info.setCity("北京"); try { myBucket.store(info.getUid(), info).execute(); } catch (Exception e) { e.printStackTrace(); } // ################查询数据. UserInfo fetchedUserInfo = null; try { fetchedUserInfo = myBucket.fetch("001", UserInfo.class).execute(); System.out.println(fetchedUserInfo); } catch (Exception e) { e.printStackTrace(); } // ################修改数据. try { fetchedUserInfo = myBucket.fetch("001", UserInfo.class).execute(); fetchedUserInfo.setName("李四"); fetchedUserInfo.setNickName("老李"); myBucket.store(info.getUid(), info).execute(); // 保存 新数据 fetchedUserInfo = myBucket.fetch("001", UserInfo.class).execute(); System.out.println("新数据:" + fetchedUserInfo); } catch (Exception e) { e.printStackTrace(); } // ################删除数据. try { myBucket.delete("001").execute(); fetchedUserInfo = myBucket.fetch("001", UserInfo.class).execute(); System.out.println("删除收数据." + fetchedUserInfo); } catch (Exception e) { e.printStackTrace(); } // 关闭。 client.shutdown(); } }
View Code
相关文章推荐
- Linux下java程序启动脚本(可做开机自启动Service脚本)
- Linux 下安装配置 JDK
- Linux上挂载新硬盘详解
- Linux编译安装mysql
- UEFI+GPT安装kila linux2.0和win8.1双系统
- linux系统硬件配置查看方法
- Centos 163源下载路径
- centos openwrt 开发环境搭建
- Linux命令 - 用户登录查看命令 w
- Linux下安装JRE
- Linux四种进程通信机制
- linux命令- 挂载命令 mount
- 以生产者消费者为例实现Linux进程线程控制
- PHP与Linux进程间的通信
- 鸟哥的Linux私房菜-----16、程序与资源管理
- 鸟哥的Linux私房菜-----15、例行性命令at与crontab
- linux进程信号处理函数signal和sigaction
- Linux之服务器时间同步
- 鸟哥的Linux私房菜-----14、磁盘配额
- ubuntu linux 下安装配置MySQL