当我在命令下运行时,我得到下面提到的错误:
$ knife node edit hostname.domain.com
ERROR: You must set your EDITOR environment variable or configure your editor via knife.rb
Run Code Online (Sandbox Code Playgroud)
我想在knife.rb中设置编辑器值,但我无法找到与编辑器对应的选项.我已经通过以下链接解释了knife.rb支持的各种选项:
http://docs.opscode.com/config_rb_knife.html
http://docs.opscode.com/config_rb_knife_optional_settings.html
我知道我没有忽略上面的链接,但我可以;找不到与设置编辑器值相关的选项.
你能指点我正确的选择,这将有助于我设置编辑刀.
谢谢.
运行aws ec2 run-instances命令时,我的base64编码用户数据被忽略.
这是我的用户数据:
$ cat user-data.sh
#!/bin/bash
cat >> /var/tmp/user-data-testing <<EOF
this is test line added at $(date)
EOF
Run Code Online (Sandbox Code Playgroud)
这是上面脚本的base64 blob:
IyEvYmluL2Jhc2gKY2F0ID4+IC92YXIvdG1wL3VzZXItZGF0YS10ZXN0aW5nIDw8RU9GCnRoaXMgaXMgdGVzdCBsaW5lIGFkZGVkIGF0ICQoZGF0ZSkKRU9GCg==
Run Code Online (Sandbox Code Playgroud)
现在,我的下面命令确实读取了用户数据:
aws ec2 run-instances --image-id ami-8635a9b6 --instance-type t1.micro --placement AvailabilityZone=us-west-2a --security-groups quicklaunch-1 --key-name devops --user-data file://user-data.sh
Run Code Online (Sandbox Code Playgroud)
我确实看到该文件/var/tmp/user-data-testing已创建.
但是,当我尝试将用户数据作为base64编码的blob传递如下时,它会被忽略:
aws ec2 run-instances --image-id ami-8635a9b6 --instance-type t1.micro --placement AvailabilityZone=us-west-2a --security-groups quicklaunch-1 --key-name devops --user-data IyEvYmluL2Jhc2gKY2F0ID4+IC92YXIvdG1wL3VzZXItZGF0YS10ZXN0aW5nIDw8RU9GCnRoaXMgaXMgdGVzdCBsaW5lIGFkZGVkIGF0ICQoZGF0ZSkKRU9GCg==
Run Code Online (Sandbox Code Playgroud)
现在,我没有看到/var/tmp/user-data-testing创建的文件.
另外,我知道我的base64 blob是健康的,因为我可以解码它:
$ base64 --decode <<< IyEvYmluL2Jhc2gKY2F0ID4+IC92YXIvdG1wL3VzZXItZGF0YS10ZXN0aW5nIDw8RU9GCnRoaXMgaXMgdGVzdCBsaW5lIGFkZGVkIGF0ICQoZGF0ZSkKRU9GCg==
#!/bin/bash
cat >> /var/tmp/user-data-testing <<EOF
this is test line added …Run Code Online (Sandbox Code Playgroud) 这不是Ruby等效于Perl Data :: Dumper的重复.这个问题已超过3.5年,因此想要检查从那时起Ruby中是否有任何新选项.
我在寻找perl Dumper在ruby中的等价物.我不在乎翻车机幕后做什么.我已经广泛使用它在perl中打印深嵌套哈希和数组.到目前为止,我还没有在ruby中找到替代方案(或者我可能没有找到一种方法来充分利用Ruby中的可用替代方案).
这是我的perl代码及其输出:
#!/usr/bin/perl -w
use strict;
use Data::Dumper;
my $hash;
$hash->{what}->{where} = "me";
$hash->{what}->{who} = "you";
$hash->{which}->{whom} = "she";
$hash->{which}->{why} = "him";
print Dumper($hash);
Run Code Online (Sandbox Code Playgroud)
OUTPUT:
$VAR1 = {
'what' => {
'who' => 'you',
'where' => 'me'
},
'which' => {
'why' => 'him',
'whom' => 'she'
}
};
Run Code Online (Sandbox Code Playgroud)
只是喜欢翻车机.:)
在Ruby中,我尝试了pp,p,inspect和yaml.这是我在ruby中的相同代码及其输出:
#!/usr/bin/ruby
require "pp"
require "yaml"
hash = Hash.new{ |h,k| h[k] = Hash.new(&h.default_proc) } …Run Code Online (Sandbox Code Playgroud) 我看到了aws s3 ls和aws s3api list-buckets的不同行为
这是第一个:
$ aws s3 ls s3://demo.for.customers
Bucket: demo.for.customers
Prefix:
LastWriteTime Length Name
------------- ------ ----
PRE 5CE4D191-FD14-4C85-8146-9FB8C29B7A7B/
PRE FFBC4675-F864-40E9-8AB8-BDF7A0437010/
Run Code Online (Sandbox Code Playgroud)
所以,我能够列出demo.for.customers中的对象
现在,当我使用s3api运行相同的东西时,我被拒绝访问:
$ aws s3api list-objects --bucket demo.for.customers
A client error (AccessDenied) occurred: Access Denied
Run Code Online (Sandbox Code Playgroud)
问题:为什么我通过s3api拒绝列出对象的访问权限.
我提出这个问题的原因是,如果我使用AWS S3 Ruby SDK,我会遇到同样的问题.
但是,当我使用aws s3 ls时,事情很好.
因此AWS S3 Ruby SDK和aws s3api表现出相同的行为.所以,我在这里只粘贴了aws s3api CLI问题.
顺便说一句,这是已应用于运行以上所有命令的用户的IAM策略:
{
"Statement": [
{
"Action": [ …Run Code Online (Sandbox Code Playgroud) 这不是一个编程问题,但大多数使用Eclipse的程序员应该得到我正在寻找的答案.
我正在运行eclipse Indigo(v 3.7).但我没有找到创建Web服务客户端的选项.
到目前为止,我的谷歌搜索建议我应该做以下事情:
文件 - >新建项目 - >其他在"选择向导"弹出窗口下,选择"Web服务"选项.
所以,就我而言,我根本看不到"Web服务".
这个版本是在Windows上运行的,所以我在我的ubuntu盒子上安装了Eclipse,但我还没有看到"Web服务"选项.
我想我错过了什么.
你能帮我搞清楚吗?我最近开始学习Eclipse.
谢谢.
这个问题更多的是关于日食而不是编程.但任何使用eclipse的程序员都应该为我提供一些输入.这是我的要求:
我已经通过以下文章:
http://www.epic-ide.org/guide/ch06s02.php#N10812
在远程项目/文件上运行Eclipse EPIC Perl插件
但我无法正确解释上述链接中给出的信息.换句话说,它不适用于我,或者我的用例与这些链接中描述的不同.
那么,如上所述按照我的要求配置eclipse是否可行?如果是,那么请提供关于如何实现它的指导.如果没有,那么还有其他工作方法可以达到同样的目的.我很确定有些人必须遇到类似情况.
谢谢
我尝试使用 AWS 在浏览器网页的示例中提供的示例,但我不断收到错误NetworkingError: Network Failure。这是我正在使用的:
<html>
<head>
<script src="https://sdk.amazonaws.com/js/aws-sdk-2.0.0-rc11.min.js"></script>
<script type="text/javascript">
// See the Configuring section to configure credentials in the SDK
AWS.config.update({accessKeyId: '####', secretAccessKey: '####', region: 'us-east-1'});
// Configure your region
// AWS.config.region = '';
</script>
</head>
<body>
<input type="file" id="file-chooser" />
<button id="upload-button">Upload to S3</button>
<div id="results"></div>
<script type="text/javascript">
var bucket = new AWS.S3({params: {Bucket: 'BUCKETNAMEGOESHERE'}});
var fileChooser = document.getElementById('file-chooser');
var button = document.getElementById('upload-button');
var results = document.getElementById('results');
button.addEventListener('click', function() {
var file = fileChooser.files[0];
if …Run Code Online (Sandbox Code Playgroud) 我正在尝试在ec2的两个实例上设置zookeeper。如这里和这里所给。我正在尝试运行zookeeper,但失败并显示以下错误:命令:bin/zkCli.sh -server localhost:2181
> 2015-03-15 00:22:35,644 [myid:] - INFO [main:ZooKeeper@438] - Initiating client connection, connectString=localhost:2181 sessionTimeout=30000 watcher=org.apache.zookeeper.ZooKeeperMain$MyWatcher@3ff0efca
Welcome to ZooKeeper!
2015-03-15 00:22:35,671 [myid:] - INFO [main-SendThread(localhost:2181):ClientCnxn$SendThread@975] - Opening socket connection to server localhost/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error)
JLine support is enabled
2015-03-15 00:22:35,677 [myid:] - WARN [main-SendThread(localhost:2181):ClientCnxn$SendThread@1102] - Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
java.net.ConnectException: Connection refused
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:739)
at …Run Code Online (Sandbox Code Playgroud) 我需要针对工作日和周末制定不同的自动缩放策略。
到目前为止,我弄清楚了如何每天设置相同的策略。cmd 调用和 CRON 字符串如下所示:
as-put-scheduled-update-group-action TNUPWN --auto-scaling-group TNASG --region us-west-2 --recurrence "30 18 * * *" --desired-capacity 1
Run Code Online (Sandbox Code Playgroud)
但是当我尝试仅为工作日设置 CRON 字符串时,例如
30 7 ? * MON-FRI *
or
0 30 7 ? * MON-FRI *
Run Code Online (Sandbox Code Playgroud)
我收到错误
as-put-scheduled-update-group-action: Malformed input-Given recurrence string:30 1 ? * MON-FRI * is
invalid
Usage:
as-put-scheduled-update-group-action
ScheduledActionName --auto-scaling-group value [--desired-capacity
value ] [--end-time value ] [--max-size value ] [--min-size value ]
[--recurrence value ] [--start-time value ] [--time value ]
[General Options]
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?AWS 也可以实现吗?
我想我在这里需要一些建议。下面是我的代码:
from multiprocessing import Pool
import time
import sys
def testing(number):
count = 0
while True:
print('Count: {}'.format(count))
count += 1
if count > number:
print('Exiting...')
sys.exit()
else:
print('Looping Over')
time.sleep(1)
if __name__ == '__main__':
with Pool(2) as p:
p.map(testing, [3, 2])
Run Code Online (Sandbox Code Playgroud)
预期结果:
一旦所有子线程都退出,程序(主线程)应该退出。
实际结果:
$ python3 test_exit.py
Count: 0
Looping Over
Count: 0
Looping Over
Count: 1
Looping Over
Count: 1
Looping Over
Count: 2
Looping Over
Count: 2
Exiting... <<< Exited 1st thread.
Count: 3
Exiting... <<< Exited …Run Code Online (Sandbox Code Playgroud) amazon-ec2 ×2
amazon-s3 ×2
eclipse ×2
perl ×2
amazon-iam ×1
aws-cli ×1
base64 ×1
bucket ×1
chef-infra ×1
epic ×1
javascript ×1
python ×1
ruby ×1
solr ×1