2018-06-05java
對http://mesos.apache.org/documentation/latest/building/的實操。python
下載的mesos包中的執行文件都爲.sh.in文件且無執行權限,因此都要進行軟件源安裝。git
0、命令精簡
$ git clone https://git-wip-us.apache.org/repos/asf/mesos.git
$ sudo wget http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo -O /etc/yum.repos.d/epel-apache-maven.repo
$ sudo yum install -y epel-release
$ sudo bash -c 'cat > /etc/yum.repos.d/wandisco-svn.repo <<EOF
[WANdiscoSVN]
name=WANdisco SVN Repo 1.9
enabled=1
baseurl=http://opensource.wandisco.com/centos/7/svn-1.9/RPMS/\$basearch/
gpgcheck=1
gpgkey=http://opensource.wandisco.com/RPM-GPG-KEY-WANdisco
EOF'
$ sudo yum update systemd
$ sudo yum groupinstall -y "Development Tools"
$ sudo yum install -y apache-maven
$ sudo yum install -y python-devel
$ sudo yum install -y python-six
$ sudo yum install -y python-virtualenv
$ sudo yum install -y java-1.8.0-openjdk-devel
$ sudo yum install -y zlib-devel
$ sudo yum install -y libcurl-devel
$ sudo yum install -y openssl-devel
$ sudo yum install -y cyrus-sasl-devel
$ sudo yum install -y cyrus-sasl-md5
$ sudo yum install -y apr-devel
$ sudo yum install -y subversion-devel
$ sudo yum install -y apr-util-devel
$ cd mesos
$ ./bootstrap
$ mkdir build
$ cd build
$ ../configure
$ make clean
$ make
$ sudo make check
$ sudo make install
$ sudo ./bin/mesos-master.sh --ip=127.0.0.1 --work_dir=/var/lib/mesos
$ ./bin/mesos-agent.sh --master=127.0.0.1:5050 --work_dir=/var/lib/mesos
$ http://127.0.0.1:5050
$ ./src/test-framework --master=127.0.0.1:5050
$ ./src/examples/java/test-framework 127.0.0.1:5050
$ ./src/examples/python/test-framework 127.0.0.1:5050web
1、Downloading Mesos
There are different ways you can get Mesos:apache
方法1. Download the latest stable release from Apache (Recommended)
$ wget http://www.apache.org/dist/mesos/1.6.0/mesos-1.6.0.tar.gz
$ tar -zxf mesos-1.6.0.tar.gzbootstrap
方法2. Clone the Mesos git repository (Advanced Users Only)。在當前目錄下生成一個mesos文件
$ git clone https://git-wip-us.apache.org/repos/asf/mesos.gitcentos
NOTE: If you have problems running the above commands, you may need to first run through the System Requirements section below to install the wget, tar, and git utilities for your system.
2、System Requirements
Mesos runs on Linux (64 Bit) and Mac OS X (64 Bit). To build Mesos from source, GCC 4.8.1+ or Clang 3.5+ is required.
On Linux, a kernel version >= 2.6.28 is required at both build time and run time. For full support of process isolation under Linux a recent kernel >= 3.10 is required.
The Mesos agent also runs on Windows. To build Mesos from source, follow the instructions in the Windows section.
Make sure your hostname is resolvable via DNS or via /etc/hosts to allow full support of Docker’s host-networking capabilities, needed for some of the Mesos tests. When in doubt, please validate that /etc/hosts contains your hostname.bash
CentOS 7.1
Following are the instructions for stock CentOS 7.1. If you are using a different OS, please install the packages accordingly.
# Install a few utility tools。安裝且更新到最新
# $ sudo yum install -y tar wget git
# Fetch the Apache Maven repo file。保存到/etc/yum.repos.d/epel-apache-maven.repo
$ sudo wget http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo -O /etc/yum.repos.d/epel-apache-maven.repo
# Install the EPEL repo so that we can pull in 'libserf-1' as part of our subversion install below。更新epel-release-7-11.noarch
$ sudo yum install -y epel-release
# 'Mesos > 0.21.0' requires 'subversion > 1.8' devel package, which is not available in the default repositories. Create a WANdisco SVN repo file to install the correct version:。默認庫不可用,SVN安裝須要自定義repo庫
$ sudo bash -c 'cat > /etc/yum.repos.d/wandisco-svn.repo <<EOF
[WANdiscoSVN]
name=WANdisco SVN Repo 1.9
enabled=1
baseurl=http://opensource.wandisco.com/centos/7/svn-1.9/RPMS/\$basearch/
gpgcheck=1
gpgkey=http://opensource.wandisco.com/RPM-GPG-KEY-WANdisco
EOF'
# Parts of Mesos require systemd in order to operate. However, Mesos only supports versions of systemd that contain the 'Delegate' flag. This flag was first introduced in 'systemd version 218', which is lower than the default version installed by centos. Luckily, centos 7.1 has a patched 'systemd < 218' that contains the 'Delegate' flag. Explicity update systemd to this patched version.。centos小於7.1版本時須要安裝systemd命令。
$ sudo yum update systemd
# Install essential development tools.。安裝更新軟件羣組"Development Tools"。
$ sudo yum groupinstall -y "Development Tools"
實操警告:分組 development 不包含任何可安裝軟件包。
# Install other Mesos dependencies.。安裝更新Mesos的其餘依賴
$ sudo yum install -y apache-maven python-devel python-six python-virtualenv java-1.8.0-openjdk-devel zlib-devel libcurl-devel openssl-devel cyrus-sasl-devel cyrus-sasl-md5 apr-devel subversion-devel apr-util-devel
報錯:Error downloading packages:
subversion-devel-1.9.7-1.x86_64: [Errno 256] No more mirrors to try.
subversion-1.9.7-1.x86_64: [Errno 256] No more mirrors to try.
解決辦法:分開下載:
sudo yum install -y apache-maven
sudo yum install -y python-devel
sudo yum install -y python-six
sudo yum install -y python-virtualenv
sudo yum install -y java-1.8.0-openjdk-devel
sudo yum install -y zlib-devel
sudo yum install -y libcurl-devel
sudo yum install -y openssl-devel
sudo yum install -y cyrus-sasl-devel
sudo yum install -y cyrus-sasl-md5
sudo yum install -y apr-devel
sudo yum install -y subversion-devel
sudo yum install -y apr-util-devel
3、Building Mesos (Posix)
# Change working directory.
$ cd mesos
# Bootstrap (Only required if building from git repository).
$ ./bootstrap
# Configure and build.
$ mkdir build
$ cd build
$ ../configure
執行時報錯:configure: error: cannot find libapr-1 headers
緣由是缺乏apr-devel-1.3.9-3.el6.x86_64
須要下載相應的rpm,並安裝:
rpm -ihv apr-1.3.9-3.el6.x86_64.rpm
rpm -ihv apr-devel-1.3.9-3.el6.x86_64.rpm
rpm -ihv apr-util-1.3.9-3.el6.x86_64.rpm網絡
$ make cleanapp
$ make
報錯:
Building mesos-1.7.0.jar ...
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-remote-resources-plugin:1.3:process (default) on project mesos: Execution default of goal org.apache.maven.plugins:maven-remote-resources-plugin:1.3:process failed: Plugin org.apache.maven.plugins:maven-remote-resources-plugin:1.3 or one of its dependencies could not be resolved: Failed to collect dependencies at org.apache.maven.plugins:maven-remote-resources-plugin:jar:1.3 -> org.apache.maven.shared:maven-filtering:jar:1.0 -> org.codehaus.plexus:plexus-interpolation:jar:1.12: Failed to read artifact descriptor for org.codehaus.plexus:plexus-interpolation:jar:1.12: Could not transfer artifact org.codehaus.plexus:plexus-interpolation:pom:1.12 from/to central (https://repo.maven.apache.org/maven2): repo.maven.apache.org: Unknown host repo.maven.apache.org -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException
make[1]: *** [java/target/mesos-1.7.0.jar] 錯誤 1
make[1]: 離開目錄「/home/weis/mesos/build/src」
make: *** [all-recursive] 錯誤 1
整理:[ERROR] Failed to execute goal org.apache.maven.plugins:
maven-remote-resources-plugin:1.3:
process (default) on project mesos:
Execution default of goal org.apache.maven.plugins:
maven-remote-resources-plugin:
1.3:process failed:
Plugin org.apache.maven.plugins:
maven-remote-resources-plugin:
1.3 or one of its dependencies could not be resolved:
Failed to collect dependencies at org.apache.maven.plugins:
maven-remote-resources-plugin:
jar:1.3 -> org.apache.maven.shared:
maven-filtering:
jar:1.0 -> org.codehaus.plexus:
plexus-interpolation:
jar:1.12: Failed to read artifact descriptor for org.codehaus.plexus:
plexus-interpolation:
jar:1.12: Could not transfer artifact org.codehaus.plexus:
plexus-interpolation:
pom:
1.12 from/to central (https://repo.maven.apache.org/maven2):
repo.maven.apache.org:
Unknown host repo.maven.apache.org ->
[Help 1]
未能執行目標org.apache.maven插件
解決辦法:保持網絡鏈接
報錯二:存儲空間不足。解決辦法:須要10G的空間來運行
In order to speed up the build and reduce verbosity of the logs, you can append -j <number of cores> V=0 to make.
# Run test suite.上述make命名成功後,執行如下兩條命令
$ sudo make check
執行結果:
[----------] Global test environment tear-down
[==========] 1953 tests from 196 test cases ran. (857721 ms total)
[ PASSED ] 1953 tests.
YOU HAVE 22 DISABLED TESTS
# Install (Optional).
$ sudo make install
4、ExamplesMesos comes bundled with example frameworks written in C++, Java and Python. The framework binaries will only be available after running make check, as described in the Building Mesos section above.# Change into build directory.$ pwd/home/weis/mesos/build# Start Mesos master (ensure work directory exists and has proper permissions).。保持窗口打開,就能夠訪問了$ sudo ./bin/mesos-master.sh --ip=127.0.0.1 --work_dir=/var/lib/mesos報錯1:EXIT with status 1: Failed to initialize systemd: Failed to create systemd slice 'mesos_executors.slice': Failed to write systemd slice `/run/systemd/system/mesos_executors.slice`: Permission denied報錯2:EXIT with status 1: Failed to recover the log: IO error: /var/lib/mesos/replicated_log/LOCK: Permission denied緣由:當前賬號無/run目錄的寫權限。解決辦法:sudo命令下執行。# Start Mesos agent (ensure work directory exists and has proper permissions).$ ./bin/mesos-agent.sh --master=127.0.0.1:5050 --work_dir=/var/lib/mesos# Visit the Mesos web page.$ http://127.0.0.1:5050# Run C++ framework (exits after successfully running some tasks).運行C++框架(成功運行某些任務後退出)。找不到此文件$ ./src/test-framework --master=127.0.0.1:5050# Run Java framework (exits after successfully running some tasks).$ ./src/examples/java/test-framework 127.0.0.1:5050報錯:Failed to find /home/weis/mesos/build/src/examples.jar# Run Python framework (exits after successfully running some tasks).$ ./src/examples/python/test-framework 127.0.0.1:5050報錯:Failed to find /home/weis/mesos/build/src/examples.jarNote: These examples assume you are running Mesos on your local machine. Following them will not allow you to access the Mesos web page in a production environment (e.g. on AWS). For that you will need to specify the actual IP of your host when launching the Mesos master and ensure your firewall settings allow access to port 5050 from the outside world.