AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / user-22128

jberryman's questions

Martin Hope
jberryman
Asked: 2012-10-21 11:57:05 +0800 CST

开机后直接apt-get update导致多次Ign和Hit,导致'no installation candidate'错误

  • 0

我在使用结构脚本在 EC2 上引导服务器时遇到了一个奇怪的问题。

我启动了一个股票 Ubuntu 12.04 AMI (ami-3d4ff254),等待它启动,然后继续:

with settings(host_string="ubuntu@%s" % i.dns_name, 
              connection_attempts=30):
    sudo('apt-get -qy update')
    sudo('apt-get -qy install --no-install-recommends mdadm') # don't install postfix
    #etc...

apt-get update似乎运行良好并且没有错误,但是(大约 2/3 的时间)安装会mdadm抛出“无安装候选”错误。

当我 ssh 进入服务器并运行时,apt-get install mdadm我得到了同样的错误。手动运行apt-get update,然后包安装正常。

关于可能发生的事情的任何想法,或调试的想法?


编辑:事实证明,sleep(10)在 SSH 服务器启动之后和尝试之前添加一个apt-get update可以正常工作。这似乎是此 AMI 上的 apt 配置问题,加上亚马逊端的一些奇怪情况或 DNS 问题。

这是我的条目/etc/apt/sources.list:

deb http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ precise main
deb-src http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ precise main
deb http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ precise-updates main
deb-src http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ precise-updates main
deb http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ precise universe
deb-src http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ precise universe
deb http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ precise-updates universe
deb-src http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ precise-updates universe
deb http://security.ubuntu.com/ubuntu precise-security main
deb-src http://security.ubuntu.com/ubuntu precise-security main
deb http://security.ubuntu.com/ubuntu precise-security universe
deb-src http://security.ubuntu.com/ubuntu precise-security universe

这是apt-get update搞砸了我的mdadm安装的输出:

Ign http://security.ubuntu.com precise-security InRelease
Get:1 http://security.ubuntu.com precise-security Release.gpg [198 B]
Ign http://archive.ubuntu.com precise InRelease
Get:2 http://security.ubuntu.com precise-security Release [49.6 kB]
Ign http://archive.ubuntu.com precise-updates InRelease
Hit http://archive.ubuntu.com precise Release.gpg
Get:3 http://archive.ubuntu.com precise-updates Release.gpg [198 B]
Hit http://archive.ubuntu.com precise Release
Get:4 http://security.ubuntu.com precise-security/main amd64 Packages [177 kB]
Get:5 http://archive.ubuntu.com precise-updates Release [49.6 kB]
Hit http://archive.ubuntu.com precise/main amd64 Packages
Hit http://archive.ubuntu.com precise/restricted amd64 Packages
Hit http://archive.ubuntu.com precise/universe amd64 Packages
Hit http://archive.ubuntu.com precise/multiverse amd64 Packages
Hit http://archive.ubuntu.com precise/main i386 Packages
Hit http://archive.ubuntu.com precise/restricted i386 Packages
Hit http://archive.ubuntu.com precise/universe i386 Packages
Hit http://archive.ubuntu.com precise/multiverse i386 Packages
Get:6 http://security.ubuntu.com precise-security/restricted amd64 Packages [3,969 B]
Hit http://archive.ubuntu.com precise/main TranslationIndex
Get:7 http://security.ubuntu.com precise-security/universe amd64 Packages [48.6 kB]
Hit http://archive.ubuntu.com precise/multiverse TranslationIndex
Get:8 http://security.ubuntu.com precise-security/multiverse amd64 Packages [2,188 B]
Get:9 http://security.ubuntu.com precise-security/main i386 Packages [183 kB]
Hit http://archive.ubuntu.com precise/restricted TranslationIndex
Get:10 http://archive.ubuntu.com precise/universe TranslationIndex [2,922 B]
Get:11 http://archive.ubuntu.com precise-updates/main amd64 Packages [405 kB]
Get:12 http://security.ubuntu.com precise-security/restricted i386 Packages [3,968 B]
Get:13 http://security.ubuntu.com precise-security/universe i386 Packages [48.7 kB]
Get:14 http://security.ubuntu.com precise-security/multiverse i386 Packages [2,357 B]
Get:15 http://security.ubuntu.com precise-security/main TranslationIndex [73 B]
Get:16 http://security.ubuntu.com precise-security/multiverse TranslationIndex [71 B]
Get:17 http://security.ubuntu.com precise-security/restricted TranslationIndex [71 B]
Get:18 http://security.ubuntu.com precise-security/universe TranslationIndex [73 B]
Get:19 http://archive.ubuntu.com precise-updates/restricted amd64 Packages [8,215 B]
Get:20 http://archive.ubuntu.com precise-updates/universe amd64 Packages [149 kB]
Get:21 http://security.ubuntu.com precise-security/main Translation-en [86.5 kB]
Get:22 http://archive.ubuntu.com precise-updates/multiverse amd64 Packages [8,948 B]
Hit http://security.ubuntu.com precise-security/multiverse Translation-en
Get:23 http://archive.ubuntu.com precise-updates/main i386 Packages [410 kB]
Hit http://security.ubuntu.com precise-security/restricted Translation-en
Get:24 http://security.ubuntu.com precise-security/universe Translation-en [30.3 kB]
Get:25 http://archive.ubuntu.com precise-updates/restricted i386 Packages [8,218 B]
Get:26 http://archive.ubuntu.com precise-updates/universe i386 Packages [149 kB]
Get:27 http://archive.ubuntu.com precise-updates/multiverse i386 Packages [9,930 B]
Get:28 http://archive.ubuntu.com precise-updates/main TranslationIndex [3,564 B]
Get:29 http://archive.ubuntu.com precise-updates/multiverse TranslationIndex [2,605 B]
Get:30 http://archive.ubuntu.com precise-updates/restricted TranslationIndex [2,461 B]
Get:31 http://archive.ubuntu.com precise-updates/universe TranslationIndex [2,850 B]
Get:32 http://archive.ubuntu.com precise/main Translation-en [726 kB]
Get:33 http://archive.ubuntu.com precise/multiverse Translation-en [93.4 kB]
Get:34 http://archive.ubuntu.com precise/restricted Translation-en [2,395 B]
Get:35 http://archive.ubuntu.com precise/universe Translation-en [3,341 kB]
Get:36 http://archive.ubuntu.com precise-updates/main Translation-en [202 kB]
Get:37 http://archive.ubuntu.com precise-updates/multiverse Translation-en [5,606 B]
Get:38 http://archive.ubuntu.com precise-updates/restricted Translation-en [2,048 B]
Get:39 http://archive.ubuntu.com precise-updates/universe Translation-en [87.4 kB]
Ign http://archive.ubuntu.com precise/main Translation-en_US
Ign http://archive.ubuntu.com precise/multiverse Translation-en_US
Ign http://archive.ubuntu.com precise/restricted Translation-en_US
Fetched 6,308 kB in 8s (786 kB/s)
Reading package lists...

这是有效的输出(即在执行之前等待几秒钟后apt-get update):

Ign http://us-east-1.ec2.archive.ubuntu.com precise InRelease
Ign http://us-east-1.ec2.archive.ubuntu.com precise-updates InRelease
Get:1 http://us-east-1.ec2.archive.ubuntu.com precise Release.gpg [198 B]
Get:2 http://us-east-1.ec2.archive.ubuntu.com precise-updates Release.gpg [198 B]
Get:3 http://us-east-1.ec2.archive.ubuntu.com precise Release [49.6 kB]
Ign http://security.ubuntu.com precise-security InRelease
Get:4 http://us-east-1.ec2.archive.ubuntu.com precise-updates Release [49.6 kB]
Get:5 http://security.ubuntu.com precise-security Release.gpg [198 B]
Get:6 http://us-east-1.ec2.archive.ubuntu.com precise/main Sources [934 kB]
Get:7 http://security.ubuntu.com precise-security Release [49.6 kB]
Get:8 http://us-east-1.ec2.archive.ubuntu.com precise/universe Sources [5,019 kB]
Get:9 http://us-east-1.ec2.archive.ubuntu.com precise/main amd64 Packages [1,273 kB]
Get:10 http://security.ubuntu.com precise-security/main Sources [50.1 kB]
Get:11 http://us-east-1.ec2.archive.ubuntu.com precise/universe amd64 Packages [4,786 kB]
Get:12 http://security.ubuntu.com precise-security/universe Sources [14.5 kB]
Get:13 http://security.ubuntu.com precise-security/main amd64 Packages [177 kB]
Get:14 http://us-east-1.ec2.archive.ubuntu.com precise/main i386 Packages [1,274 kB]
Get:15 http://security.ubuntu.com precise-security/universe amd64 Packages [48.6 kB]
Get:16 http://us-east-1.ec2.archive.ubuntu.com precise/universe i386 Packages [4,796 kB]
Get:17 http://security.ubuntu.com precise-security/main i386 Packages [183 kB]
Get:18 http://us-east-1.ec2.archive.ubuntu.com precise/main TranslationIndex [3,706 B]
Get:19 http://us-east-1.ec2.archive.ubuntu.com precise/universe TranslationIndex [2,922 B]
Get:20 http://us-east-1.ec2.archive.ubuntu.com precise-updates/main Sources [178 kB]
Get:21 http://security.ubuntu.com precise-security/universe i386 Packages [48.7 kB]
Get:22 http://us-east-1.ec2.archive.ubuntu.com precise-updates/universe Sources [60.2 kB]
Get:23 http://security.ubuntu.com precise-security/main TranslationIndex [73 B]
Get:24 http://us-east-1.ec2.archive.ubuntu.com precise-updates/main amd64 Packages [405 kB]
Get:25 http://us-east-1.ec2.archive.ubuntu.com precise-updates/universe amd64 Packages [149 kB]
Get:26 http://security.ubuntu.com precise-security/universe TranslationIndex [73 B]
Get:27 http://security.ubuntu.com precise-security/main Translation-en [86.5 kB]
Get:28 http://security.ubuntu.com precise-security/universe Translation-en [30.3 kB]
Get:29 http://us-east-1.ec2.archive.ubuntu.com precise-updates/main i386 Packages [410 kB]
Get:30 http://us-east-1.ec2.archive.ubuntu.com precise-updates/universe i386 Packages [149 kB]
Get:31 http://us-east-1.ec2.archive.ubuntu.com precise-updates/main TranslationIndex [3,564 B]
Get:32 http://us-east-1.ec2.archive.ubuntu.com precise-updates/universe TranslationIndex [2,850 B]
Get:33 http://us-east-1.ec2.archive.ubuntu.com precise/main Translation-en [726 kB]
Get:34 http://us-east-1.ec2.archive.ubuntu.com precise/universe Translation-en [3,341 kB]
Get:35 http://us-east-1.ec2.archive.ubuntu.com precise-updates/main Translation-en [202 kB]
Get:36 http://us-east-1.ec2.archive.ubuntu.com precise-updates/universe Translation-en [87.4 kB]
Fetched 24.6 MB in 12s (1,976 kB/s)
Reading package lists...

我不知道为什么前者充满了更多Hit的s和Igns。

linux
  • 1 个回答
  • 1289 Views
Martin Hope
jberryman
Asked: 2012-10-19 06:48:01 +0800 CST

更快地创建新的 RAID1 阵列

  • 0

我是 RAID 新手。从空白的、新分区的 100GB 磁盘创建一个新的 RAID1 阵列

sudo mdadm --create --verbose /dev/md0 --level=mirror --raid-devices=2 /dev/xvdf1 /dev/xvdg1

...看起来需要大约一个小时来重建。我的问题是:

  1. 是否有任何快捷方式可以在这个初始“重新同步”上使用,因为没有(AFAIK)我需要在空磁盘之间复制的任何数据

  2. 当它处于初始同步的中间时,我可以像对待普通磁盘一样愉快地格式化/dev/md0它,只要我可以接受它处于“降级”状态一段时间吗?

linux
  • 2 个回答
  • 62 Views
Martin Hope
jberryman
Asked: 2010-04-15 15:15:36 +0800 CST

服务器负载低时如何运行作业?

  • 4

我有一个运行磁盘快照的命令(在 EC2 上,冻结 XFS 磁盘并运行 EBS 快照命令),该命令设置为作为 cron 作业定期运行。理想情况下,如果在计划运行任务时磁盘被大量使用,我希望能够将命令延迟一段时间。

我担心使用 nice/ionice 可能不会产生适当的效果,因为我希望脚本在运行时以高优先级运行(即等待一段时间,然后快速完成)。

谢谢。

更新:

这就是我最终的结果。它检查 /proc/diskstats 并在当前 IO 活动达到 0 或我们超时时运行我的作业。当我查看我们的服务器在生产中实际获得什么样的 IO 活动时,我可能不得不对此进行调整:

#!/bin/bash

DEVICE=sdf

# we want to make a snapshot when IO in progresses reaches this:
LOW_THRESHOLD=0

TIMER=0
MAX_SEC_DELAY=120

# Get the number of IO operations in progress:
ioInProgress(){
    grep $DEVICE /proc/diskstats | awk '{print $12}'
}

# Wait for a good time to run snapshot, else timeout:

while [[ $TIMER -lt $MAX_SEC_DELAY && $(ioInProgress) -gt $LOW_THRESHOLD  ]]; do
    TIMER=`expr $TIMER + 1`
    sleep 0.5
done

# Recording delay required:
echo $TIMER
echo "Executing snapshot"
run-the-snapshot
linux scheduled-task bash cron amazon-ec2
  • 3 个回答
  • 1181 Views
Martin Hope
jberryman
Asked: 2010-03-10 16:44:49 +0800 CST

从 Amazon EC2 中的 XFS 磁盘通过 NFS 进行非常慢的顺序读取

  • 1

我正在使用 tiobench 测试 NFS 安装卷的性能,并注意到Sequential Reads比Random Reads慢得多。当我在本地安装的磁盘上运行相同的测试时,这不是行为。

这是一个小图,NFS 为红色,左侧为顺序读取:

由 imgur.com 主办

我正在像这样导出服务器上的卷

/export *.internal(no_subtree_check,rw,no_root_squash)

并安装:

mount -o hard,intr,async,noatime,nodiratime,noacl $NFS_SERVER:/export /nfs 

此外,我在亚马逊 EC2 中执行所有这些操作,使用 XFS 文件系统导出 EBS 卷(冗余,我知道)。

我尝试过使用巨型帧和其他各种安装选项,但似乎都没有太大效果。

感谢您提供任何线索。

performance nfs amazon-ec2 xfs
  • 1 个回答
  • 1216 Views
Martin Hope
jberryman
Asked: 2010-02-25 10:13:34 +0800 CST

不使用数据时备份用户数据。我应该担心吗?

  • 0

这可能是一个愚蠢的问题。我想使用重复性将目录备份到 Amazon S3,每个目录都包含不同的用户数据。每个目录都可以随时写入。所以我有两个问题:

我是否应该担心在将数据写入目录中的文件的过程中可能会发生目录的计划备份,从而导致备份损坏?

如果这是一个有效的问题,我将如何在 IO 发生时暂时延迟操作,以尽量减少这种影响。

感谢您的建议

backup linux amazon-s3 corruption
  • 1 个回答
  • 73 Views
Martin Hope
jberryman
Asked: 2009-10-15 17:55:27 +0800 CST

是否可以从 EC2 中运行的任何实例访问 Amazon EC2 私有 IP?

  • 13

在这里搜索以前的问题后,普遍的共识似乎是,如果我拥有的实例被分配了一个私有 IP 10.208.34.55,那么只有我拥有的其他实例才能在该地址访问它。看:

如何加密两个 Amazon EC2 实例之间的流量?

那是对的吗?因此,我可以将我的所有实例视为在 LAN 上,并验证和信任来自 10.XXX.XXX.XXX 的任何机器,因为我确定我拥有它?

我只是想确定一下。我发现亚马逊似乎更感兴趣的是对 The Cloud 及其 3 个字符的缩写充满诗意,而不是实际提供清晰的技术文档。

networking
  • 3 个回答
  • 10654 Views
Martin Hope
jberryman
Asked: 2009-10-08 17:18:04 +0800 CST

使用 Samba/NFS 在本地和远程同时访问共享卷

  • 1

我将运行一个服务器,它将处理本地磁盘上的数据。我还想通过 LAN 与 Samba 或 NFS 共享卷到服务器,这些服务器也将写入磁盘上的数据。

我的主服务器是否应该同时充当 Samba/NFS 服务器和客户端(即所有通过 samba 与光盘交互的东西)?或者在主服务器上正常安装和使用已安装的驱动器是否安全,同时其他服务器正在通过 Samba/NFS 写入数据?

也欢迎对网络文件服务器的选择提出任何意见。谢谢!

samba
  • 2 个回答
  • 475 Views
Martin Hope
jberryman
Asked: 2009-10-07 10:31:31 +0800 CST

通过网络向网络服务器提供 sqlite 数据库的最佳系统?

  • 2

我正在帮助建立一个 Web 服务,其中用户数据将存储在可能运行 Samba 的服务器上的 sqlite 数据库中,并且一个或多个 Web 服务器将在后端读取和写入这些数据库。我想就在全 linux 环境中使用哪个网络文件系统以及任何其他想法提出建议

samba
  • 4 个回答
  • 1974 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve