当我运行 vagrant up 以在 Lion 上配置一个新的 VM 时,它需要非常长的时间,在此期间整个 Mac 非常缓慢且无响应。
输出如下,重点是“注意:在754.28秒内完成目录运行”
> vagrant up
[default] Importing base box 'lucid64'...
[default] The guest additions on this VM do not match the install version of
VirtualBox! This may cause things such as forwarded ports, shared
folders, and more to not work properly. If any of those things fail on
this machine, please update the guest additions and repackage the
box.
Guest Additions Version: 4.1.0
VirtualBox Version: 4.1.6
[default] Matching MAC address for …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 Ansible 来配置 Vagrant VM。VM 正在运行 CentOS 6.4。我正在使用以下(缩写)ansible playbook:
- hosts: default
vars:
home: '/home/vagrant'
curl_version: '7_19_7'
curl_url: 'https://github.com/bagder/curl/archive/curl-{{ curl_version }}.tar.gz'
curl_dir: '{{ home }}/curl-curl-{{ curl_version }}'
# user: vagrant
remote_user: vagrant
sudo: yes
tasks:
- name: Ensure required packages and installed and up to date - pt1
yum: pkg={{ item }} state=present
with_items:
- make
- gcc
- etc...
# Lots more yum tasks in here
- name: Ensure CURL source downloaded
get_url: url={{ curl_url }} dest=/home/vagrant/curl-{{ curl_version }}.tar …Run Code Online (Sandbox Code Playgroud) 我正在尝试将我的项目设置到虚拟机中,以便我可以在我的主机上使用它。我已经在 vagrantfile 中设置了端口转发,当我运行 'vagrant up' 时一切正常,没有错误。但是当我尝试从主机访问 VM 中的应用程序时,我不能。我的流浪文件非常简单:
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure("2") do |config|
config.vm.box = "hashicorp/precise32"
config.vm.network :forwarded_port, host: 4567, guest: 8001
config.vm.synced_folder "data", "/home/vagrant/projects/myapp/"
end
Run Code Online (Sandbox Code Playgroud)
一开始我得到这个:
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
==> default: Forwarding ports...
default: 8001 => 4567 (adapter 1)
default: 22 => 2222 (adapter 1)
Run Code Online (Sandbox Code Playgroud)
看起来一切正常,但是当我尝试从我的主机访问 127.0.0.1:4567(并且我在 127.0.0.1:8001 上的来宾机器上运行我的应用程序)时,我ERR_EMPTY_RESPONSE在浏览器中收到err_code。我做错了什么?
我有一个简单的 Vagrant Ubuntu 虚拟机设置,使用 Virtual Box,在 Mac 上运行。
我正在使用专用网络,配置了静态专用 IP,如下所示:
Vagrant.configure("2") do |config|
config.vm.network :private_network, ip: "10.11.12.13"
end
Run Code Online (Sandbox Code Playgroud)
这工作正常,除非我在 wifi 和有线网络之间来回切换。当我这样做时,我似乎无法再使用它的静态 IP 地址连接到 VM。我试过停止并重新启动虚拟机,甚至破坏并重新创建虚拟机,但无济于事。
有没有办法重置网络连接,以便私有 IP 回来?我可以直接在 VirtualBox 或其他任何地方访问它。我可以让它工作的唯一方法是现在实际重新启动我的整个机器。
我在 Mac OS 上运行 Vagrant 1.8.1 和 ansible 1.8.4。
我已经在 vagrant 上启动了 2 台 Ubuntu 机器:
itais-MacBook-Pro:ansible-dir itaiganot$ ./dev/hosts --list | jq '.'
{
"web": [
"web"
],
"app": [
"app-1"
],
"vagrant": [
"web",
"app-1"
],
"_meta": {
"hostvars": {
"web": {
"ansible_ssh_host": "127.0.0.1",
"ansible_ssh_port": "2201",
"ansible_ssh_user": "vagrant",
"ansible_ssh_private_key_file": "/Users/itaiganot/ansible-dir/.vagrant/machines/web/virtualbox/private_key"
},
"app-1": {
"ansible_ssh_host": "127.0.0.1",
"ansible_ssh_port": "2202",
"ansible_ssh_user": "vagrant",
"ansible_ssh_private_key_file": "/Users/itaiganot/ansible-dir/.vagrant/machines/app-1/virtualbox/private_key"
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
我ansible.cfg在 VagrantFile 所在的当前目录中有一个文件。
itais-MacBook-Pro:ansible-dir itaiganot$ cat ansible.cfg
[defaults]
host_key_checking = False
inventory …Run Code Online (Sandbox Code Playgroud) 我的设置:
sudo vagrant up一直在工作,突然它停止工作......它一直卡在SSH auth method: private key直到超时。
所以我在sudo vagrant up启用 GUI 的情况下运行以检查错误,以及我发现的内容:
Scanning for Btrfs filesystems
/dev/mapper/vagrant--vg-root: contains a file system with errors, check forced.
/dev/mapper/vagrant--vg-root: Inodes that were part of a corrupted orphan linked list found.
/dev/mapper/vagrant--vg-root: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY. (i.e., without -a or -p options)
fsck exited with status code 4
The root filesystem on /dev/mapper/vagrant--vg-root requires manual fsck …Run Code Online (Sandbox Code Playgroud) 我只是使用 Vagrant 在一个硬件上设置虚拟机。我想使用 Puppet 来配置它们,然后尝试设置 OpenStack。我不确定我是否理解最后应该如何看待。毕竟我将在 Linux 上运行一个虚拟机,是否可以使用 OpenStack 使用以下架构?
-------------------------------
| VM with OS |
-------------------------------
| NOVA | NOVA | NOVA |
-------------------------------
| OpenStack |
-------------------------------
| Node | Node | Node |
-------------------------------
Run Code Online (Sandbox Code Playgroud)
更多细节:
在我的环境中,节点只是虚拟机,但我的问题涉及单独的硬件节点。如果我们想象这个节点(Novas)被放置在不同的机器上(例如每个有 4 个内核),我可以在多个 OpenStack 节点上运行一个虚拟机吗?是否可以在一个虚拟分布式操作系统中聚合 OpenStack 的计算能力?
我注意到我们的 web 项目 (Drupal) 在虚拟机中使用 memcached 时运行速度较慢。页面加载时间是没有 memcached 的两倍。我没有注意到任何不自然的 memcached 行为。
虚拟框是(使用 vagrant):
Drupal 的特定设置是:
$conf['cache_backends'][] = 'sites/all/modules/contrib/memcache/memcache.inc';
$conf['cache_class_cache_form'] = 'DrupalDatabaseCache';
$conf['cache_default_class'] = 'MemCacheDrupal';
$conf['memcache_key_prefix'] = 'oursite_';
Run Code Online (Sandbox Code Playgroud)
只是将其与本机(非虚拟化)环境进行比较 - 在同一项目上,memcached 提高了 10-20% 的性能。
任何的想法?有什么地方可以让我继续调查吗?
我有一个非常简单的 Puppet(子)模块,它应该使用 Git 从远程位置克隆存储库:
class wppuppet::git(
$location = '/var/www/wp'
) {
file { $location:
ensure => 'directory',
mode => '0755',
}
exec { 'git-wp':
command => 'git clone https://github.com/WordPress/WordPress ${location}',
require => Package['git'],
}
Package['git']
-> File[ $location ]
-> Exec['git-wp']
}
Run Code Online (Sandbox Code Playgroud)
由于某种原因,它经常失败并出现以下错误:
Error: git clone https://github.com/WordPress/WordPress ${location} returned 128 instead of one of [0]
Error: /Stage[main]/Wppuppet::Git/Exec[git-wp]/returns: change from notrun to 0 failed:
git clone https://github.com/WordPress/WordPress ${location} returned 128 instead one of [0]
Run Code Online (Sandbox Code Playgroud)
我用${location}和尝试过$location,但结果保持不变。
我正在尝试创建一个安装 MariaDB 的配置文件,但它一直失败。
该条款如下所示:
sudo apt-get install -y software-properties-common
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db
sudo add-apt-repository 'deb http://ftp.cc.uoc.gr/mirrors/mariadb/repo/10.0/ubuntu trusty main'
apt-get update -y
apt-get install -y mariadb-server
Run Code Online (Sandbox Code Playgroud)
我得到的错误是:
==> default: Preparing to unpack .../mariadb-server-10.0_10.0.17+maria-1~trusty_amd64.deb ...
==> default: (B)00
[BLANK SPACES HERE]
==> default: Package configuration??????????????????????????????????????????????????????????????? Configuring mariadb-server-10.0 ?????????????????????????????????????????????????????????????????? While not mandatory, it is highly recommended that you set a password ?????? for the MariaDB administrative "root" user.???????????? If this field is left blank, the password will not be …Run Code Online (Sandbox Code Playgroud) 为了测试,我设置了一个非常简单的Vagrant文件。这只是为了测试如何使用Ansible。可悲的是,我被困在第 2 步,期间出现以下错误vagrant up --provision(我可以重复reload):
'ansible-playbook'在 PATH 变量中找不到 Vagrant 尝试运行的可执行文件。这是一个错误。请验证此软件已安装并在路径上。
由于Ubuntu 14 “Trusty” 64bit box 没有安装Ansible,我添加了一个快速的 shell 脚本,在实际的Ansible playbook之前作为配置器运行。这是Vagrantfile
Vagrant.require_version ">= 1.7.0"
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/trusty64"
config.ssh.insert_key = false
# Synced folders
config.vm.synced_folder "./public", "/var/www",
disabled: false
# Install Ansible
config.vm.provision :shell,
path: "provisioners/shell/install-ansible.sh"
# Run Ansible Playbooks
config.vm.provision "ansible" do |ansible|
ansible.verbose = "vvv"
ansible.playbook = "provisioners/ansible/playbook.yml"
end
end …Run Code Online (Sandbox Code Playgroud) vagrant ×11
virtualbox ×4
ansible ×3
mac-osx ×3
apt ×1
drupal ×1
fsck ×1
git ×1
mariadb ×1
memcached ×1
mysql ×1
nova-network ×1
openstack ×1
osx-lion ×1
private-ip ×1
provisioning ×1
puppet ×1
ubuntu ×1