分类 [ 技术 ] 下的文章:

PostgreSQL 启动错误:No space left on device

错误信息:

pg_ctl[2442]: FATAL:  could not create semaphores: No space left on device
pg_ctl[2442]: DETAIL:  Failed system call was semget(5432129, 17, 03600).
pg_ctl[2442]: HINT:  This error does *not* mean that you have run out of disk space...

阅读全文>>

packstack安装openstack出现Failed synchronizing routers...

openstack在用packstack安装过程中出现以下错误:

2015-12-23 21:48:35.572 4731 ERROR neutron.agent.l3.agent [-] Failed synchronizing routers due to RPC error
2015-12-23 21:48:35.572 4731 TRACE neutron.agent.l3.agent Traceback (most recent call last):
2015-12-23 21:48:35.572 4731 TRACE neutron.agent.l3.agent   File "/usr/lib/python2.7/site-packages/neutron/agent/l3/agent.py", line 520, in fetch_and_sync_all_routers
2015-12-23 21:48:35.572 4731 TRACE neutron.agent.l3.agent     routers = self.plugin_rpc.get_routers(context)
2015-12-23 21:48:35.572 4731 TRACE neutron.agent.l3.agent   File "/usr/lib/python2.7/site-packages/neutron/agent/l3/agent.py", line 92, in get_routers
2015-12-23 21:48:35.572 4731 TRACE neutron.agent.l3.agent     router_ids=router_ids)
2015-12-23 21:48:35.572 4731 TRACE neutron.agent.l3.agent   File "/usr/lib/python2.7/site-packages/oslo_messaging/rpc/client.py", line 156, in call
2015-12-23 21:48:35.572 4731 TRACE neutron.agent.l3.agent     retry=self.retry)
2015-12-23 21:48:35.572 4731 TRACE neutron.agent.l3.agent   File "/usr/lib/python2.7/site-packages/oslo_messaging/transport.py", line 90, in _send
2015-12-23 21:48:35.572 4731 TRACE neutron.agent.l3.agent     timeout=timeout, retry=retry)
2015-12-23 21:48:35.572 4731 TRACE neutron.agent.l3.agent   File "/usr/lib/python2.7/site-packages/oslo_messaging/_drivers/amqpdriver.py", line 350, in send
2015-12-23 21:48:35.572 4731 TRACE neutron.agent.l3.agent     retry=retry)
2015-12-23 21:48:35.572 4731 TRACE neutron.agent.l3.agent   File "/usr/lib/python2.7/site-packages/oslo_messaging/_drivers/amqpdriver.py", line 341, in _send
2015-12-23 21:48:35.572 4731 TRACE neutron.agent.l3.agent     raise result
2015-12-23 21:48:35.572 4731 TRACE neutron.agent.l3.agent RemoteError: Remote error: AgentNotFoundByTypeHost Agent with agent_type=L3 agent and host=nfvi could not be found
2015-12-23 21:48:35.572 4731 TRACE neutron.agent.l3.agent [u'Traceback (most recent call last):\n', u'  File "/usr/lib/python2.7/site-packages/oslo_messaging/rpc/dispatcher.py", line 142, in _dispatch_and_reply\n    executor_callback))\n', u'  File "/usr/lib/python2.7/site-packages/oslo_messaging/rpc/dispatcher.py", line 186, in _dispatch\n    executor_callback)\n', u'  File "/usr/lib/python2.7/site-packages/oslo_messaging/rpc/dispatcher.py", line 130, in _do_dispatch\n    result = func(ctxt, **new_args)\n', u'  File "/usr/lib/python2.7/site-packages/neutron/api/rpc/handlers/l3_rpc.py", line 81, in sync_routers\n    context, host, router_ids))\n', u'  File "/usr/lib/python2.7/site-packages/neutron/db/l3_agentschedulers_db.py", line 290, in list_active_sync_routers_on_active_l3_agent\n    context, constants.AGENT_TYPE_L3, host)\n', u'  File "/usr/lib/python2.7/site-packages/neutron/db/agents_db.py", line 197, in _get_agent_by_type_and_host\n    host=host)\n', u'AgentNotFoundByTypeHost: Agent with agent_type=L3 agent and host=nfvi could not be found\n'].

请确认controller和compute服务器上的时间是否同步。

修改RedHat/CentOS系统时区

时区文件目录:

$ ls /usr/share/zoneinfo/
Africa      Asia       Canada   Cuba   EST      GB       GMT-0      
America     Atlantic   CET      EET    EST5EDT  GB-Eire  GMT+0      
Antarctica  Australia  Chile    Egypt  Etc      GMT      Greenwich  
Arctic      Brazil     CST6CDT  Eire   Europe   GMT0     Hongkong   
HST      iso3166.tab  Kwajalein  MST      NZ-CHAT   posix       
Iceland  Israel       Libya      MST7MDT  Pacific   posixrules  
Indian   Jamaica      MET        Navajo   Poland    PRC         
Iran     Japan        Mexico     NZ       Portugal  PST8PDT     
right    Turkey       UTC        Zulu     ROC       UCT        
WETStep2ROK           Universal  W-SUSingapore    US   zone.tab1

修改时区

$ sudo ln -s /usr/share/zoneinfo/EST /etc/localtime -f

保存

$ sudo hwclock --systohc

为RedHat/Centos 7添加Windows7引导程序

由于安装redhat/centos7无法选择boot分区,所以安装完后会丢失原有的windows7系统引导,解决方法如下:

编辑文件/boot/grub2/grub.cfg,添加以下内容:

### BEGIN /etc/grub.d/30_os-prober ###
menuentry 'Windows 7 (loader) (on /dev/sda1)' --class windows --class os $menuentry_id_option 'osprober-chain-WIN7UUID' {
insmod part_msdos
insmod ntfs
set root='hd0,msdos1'
chainloader +1
}
### END /etc/grub.d/30_os-prober ###

WIN7UUID替换为win7系统分区的UUID。
hd0需按照实际修改。

RedHat/CentOS 7下修改网卡的设备名

该方法适用于物理机上的系统,同时也适用于kvm等虚拟机上安装的系统。
需要修改的文件/lib/udev/rules.d/60-net.rules

#刚装完的系统应该只有下面一句话
ACTION=="add", SUBSYSTEM=="net", DRIVERS=="?*", ATTR{type}=="1", PROGRAM="/lib/udev/rename_device", RESULT=="?*", NAME="$result"

阅读全文>>

代码高亮测试

java code

package om.cmd.usr.define;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class TestCmd {
    public static void main(String[] args){
        String cmd = "om wait 10s";
        if ( cmd.matches( "om .*")) {
            if ( cmd.matches( "om wait .*")) {
                Pattern p=Pattern. compile("(?<=om wait )([0-9]*)(?=s)");
                Matcher m= p.matcher( cmd);
                while( m.find()){
                    // result : 10
                    System. out.println( "result: " + m.group());
                }
                System. out.println( "over");
            }
        }
    }
}
# end

c code

#include <stdio.sh>

void main(char * args){
    printf("hello world : %s","zhouzhiping");
}
// end

bash code

#!/bin/bash
for line in `ls`
do
    echo "$line"
done

python code

import os

Class Test():
    def __init__(self):
        pass

    def test(self):
        print "hello world"

结束!