CentOS上安装mesos和实例测试

来源:互联网 发布:淘宝拍照片搜索宝贝 编辑:程序博客网 时间:2024/05/06 18:30

1 安装Mesos

在centOS上安装mesos,可以分为下面几个步骤。

必要的系统工具和库,运行下面的命令即可。

$sudo yum groupinstall "Developmenttools"$sudo yum installjava-1.6.0-openjdk.x86_64 java-1.6.0-openjdk-devel.x86_64 python python-devel libcurllibcurl-devel


下载mesos源码,安装mesos命令行步骤:

$wgethttp://www.apache.org/dist/mesos/0.19.0/mesos-0.19.0.tar.gz$tar -zxf mesos-0.19.0.tar.gz$mv mesos-0.19.0 mesos#./configure --prefix=/opt/mesos &&make && make check && make install./configure --prefix=/opt/mesos &&make && make install


注意:

1. 编译过程中,会报一个错误,javadoc引用出错。解决方法是,直接进入src/java目录下,mesos.pom文件中,注释掉这行记录就可以了。

2. 如果时间不是那么充裕,可以不运行make check验证命令。原因是它将耗费好长的时间来执行验证脚本程序。


2 实例测试

     Mesos实例有用C++, Java和Python编写,操作步骤如下:

 # Change into build directory. $ cd build  # Start mesos master (***Ensure work directory exists and has proper permissions***). $ ./bin/mesos-master.sh --ip=127.0.0.1 --work_dir=/var/lib/mesos  # Start mesos slave. $ ./bin/mesos-slave.sh --master=127.0.0.1:5050  # Visit the mesos web page. $ http://127.0.0.1:5050


C++实例:

 # Run C++ framework (***Exits after successfully running some tasks.***). $ ./src/test-framework --master=127.0.0.1:5050I0721 11:06:55.031108  6857 sched.cpp:126] Version: 0.19.0I0721 11:06:55.035475  6883 sched.cpp:222] New master detected atmaster@127.0.0.1:5050I0721 11:06:55.036548  6883 sched.cpp:230] No credentials provided.Attempting to register without authenticationI0721 11:06:55.040148  6883 sched.cpp:397] Framework registered with20140721-110017-16777343-5050-6678-0001Registered!.Starting task 0 on hadoop-masterTask 0 is in state 1Task 0 is in state 2.Starting task 1 on hadoop-masterTask 1 is in state 1Task 1 is in state 2.Starting task 2 on hadoop-masterTask 2 is in state 1Task 2 is in state 2.Starting task 3 on hadoop-masterTask 3 is in state 1Task 3 is in state 2.Starting task 4 on hadoop-masterTask 4 is in state 1Task 4 is in state 2I0721 11:06:59.736284  6880 sched.cpp:730] Stopping framework'20140721-110017-16777343-5050-6678-0001'



Java实例:

# Run Java framework (***Exits after successfully running some tasks.***). $ ./src/examples/java/test-framework 127.0.0.1:5050略…

Python实例:

 # Run Python framework (***Exits after successfully running some tasks.***). $ ./src/examples/python/test-framework 127.0.0.1:5050[app@hadoop-mastermesos]$ ./src/examples/python/test-framework 127.0.0.1:5050I072111:05:07.645002  6807 sched.cpp:126]Version: 0.19.0I072111:05:07.650837  6813 sched.cpp:222] Newmaster detected at master@127.0.0.1:5050I072111:05:07.652999  6813 sched.cpp:230] Nocredentials provided. Attempting to register without authenticationI072111:05:07.659893  6813 sched.cpp:397]Framework registered with 20140721-110017-16777343-5050-6678-0000Registeredwith framework ID 20140721-110017-16777343-5050-6678-0000Got1 resource offersGotresource offer 20140721-110017-16777343-5050-6678-0Acceptingoffer on hadoop-master to start task 0Task0 is in state 1Task0 is in state 2Receivedmessage: 'data with a \x00 byte'Got1 resource offersGotresource offer 20140721-110017-16777343-5050-6678-1Acceptingoffer on hadoop-master to start task 1Task1 is in state 1Task1 is in state 2Receivedmessage: 'data with a \x00 byte'Got1 resource offersGotresource offer 20140721-110017-16777343-5050-6678-2Acceptingoffer on hadoop-master to start task 2Task2 is in state 1Task2 is in state 2Receivedmessage: 'data with a \x00 byte'Got1 resource offersGotresource offer 20140721-110017-16777343-5050-6678-3Acceptingoffer on hadoop-master to start task 3Task3 is in state 1Task3 is in state 2Receivedmessage: 'data with a \x00 byte'Got1 resource offersGotresource offer 20140721-110017-16777343-5050-6678-4Acceptingoffer on hadoop-master to start task 4Task4 is in state 1Task4 is in state 2Alltasks done, waiting for final framework messageReceivedmessage: 'data with a \x00 byte'Alltasks done, and all messages received, exitingI072111:05:14.626263  6817 sched.cpp:730]Stopping framework '20140721-110017-16777343-5050-6678-0000'






欢迎关注我的微信公众号


0 0
原创粉丝点击