存档

2011年7月 的存档

从源码编译rpm,安装升级 openssl及openssh 最新版本

2011年7月22日 评论已被关闭

当前版本:
$ ssh -V
OpenSSH_4.3p2, OpenSSL 0.9.8e-fips-rhel5 01 Jul 2008
目标版本:
openssh-5.8p2.tar.gz
openssl-0.9.8r.tar.gz

compile and upgrade openssl-0.9.8r
wget http://www.openssl.org/source/openssl-0.9.8r.tar.gz
tar zxvf openssl-0.9.8r.tar.gz
mkdir -p /usr/src/redhat/SPECS/
mkdir -p /usr/src/redhat/SOURCES/
cp openssl-0.9.8r/openssl.spec /usr/src/redhat/SPECS/
cp openssl-0.9.8r.tar.gz /usr/src/redhat/SOURCES/
cd /usr/src/redhat/SPECS

#源码自带的SPEC文件有点问题,需要替换一下关键字License
perl -i.bak -pe ‘s/^Copyright: Freely distributable$/License: Freely distributable/’ openssl.spec

[2hei.net ~]#rpmbuild -bb openssl.spec
#如果系统找不到rpmbuild,需要先安装
yum install rpm-build
yum install redhat-rpm-config
yum install pam-devel

#安装结束:

Wrote: /usr/src/redhat/RPMS/i386/openssl-0.9.8r-1.i386.rpm
Wrote: /usr/src/redhat/RPMS/i386/openssl-devel-0.9.8r-1.i386.rpm
Wrote: /usr/src/redhat/RPMS/i386/openssl-doc-0.9.8r-1.i386.rpm
Wrote: /usr/src/redhat/RPMS/i386/openssl-debuginfo-0.9.8r-1.i386.rpm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.36929
+ umask 022
+ cd /usr/src/redhat/BUILD
+ cd openssl-0.9.8r
+ rm -rf /var/tmp/openssl-0.9.8r-root
+ exit 0

[2hei.net ~]#cd /usr/src/redhat/RPMS/i386/
ls -l
-rw-r–r– 1 root root 1198354 Jul 22 15:31 openssl-0.9.8r-1.i386.rpm
-rw-r–r– 1 root root  117348 Jul 22 15:31 openssl-debuginfo-0.9.8r-1.i386.rpm
-rw-r–r– 1 root root 2149166 Jul 22 15:31 openssl-devel-0.9.8r-1.i386.rpm
-rw-r–r– 1 root root  596803 Jul 22 15:31 openssl-doc-0.9.8r-1.i386.rpm
rpm -Uvh openssl*.rpm
error: Failed dependencies:
    libcrypto.so.6 is needed by (installed) python-2.4.3-27.el5.i386
    libcrypto.so.6 is needed by (installed) openldap-2.3.43-12.el5.i386
    libcrypto.so.6 is needed by (installed) curl-7.15.5-9.el5.i386
    libcrypto.so.6 is needed by (installed) net-snmp-libs-5.3.2.2-9.el5.i386
    …
    libssl.so.6 is needed by (installed) python-2.4.3-27.el5.i386
    libssl.so.6 is needed by (installed) openldap-2.3.43-12.el5.i386
    libssl.so.6 is needed by (installed) curl-7.15.5-9.el5.i386
    …
use –nodeps force install
rpm –nodeps -Uvh openssl-*.rpm
Preparing…                ########################################### [100%]
   1:openssl                ########################################### [ 25%]
   2:openssl-debuginfo      ########################################### [ 50%]
   3:openssl-devel          ########################################### [ 75%]
   4:openssl-doc            ########################################### [100%]

#添加旧的链接库链接,使之支持已安装的其他软件的依赖:
[2hei.net ~]#cd /usr/lib
ln -s libcrypto.so.0.9.8 libcrypto.so.6
ln -s libssl.so.0.9.8 libssl.so.6

openssh的编译寄安装过程类似,不过要比openssl的简单一些,因为依赖关系少了很多,在此略去。。。

#重启sshd服务:
service sshd restart
#检查版本:
[root@test-test01 ~]# ssh -V
OpenSSH_5.8p2, OpenSSL 0.9.8r 8 Feb 2011

至此大功告成,不过升级openssl要谨慎,有可能影响其他服务,如httpd,openvpn等等,本文在vm上测试通过,权作记录备忘~

分类: OpenSource 标签: ,

cassandra cluster install and configuration

2011年7月13日 评论已被关闭

1) Install

http://labs.renren.com/apache-mirror/cassandra/0.7.6-2/apache-cassandra-0.7.6-2-bin.tar.gz(apache官网推荐人人的mirror,不过link有问题 ^_^)

  * tar -zxvf apache-cassandra-$VERSION.tar.gz
  * cd apache-cassandra-$VERSION
  * sudo mkdir -p /var/log/cassandra
  * sudo chown -R `whoami` /var/log/cassandra
  * sudo mkdir -p /var/lib/cassandra
  * sudo chown -R `whoami` /var/lib/cassandra

Note: The sample configuration files in conf/ determine the file-system
locations Cassandra uses for logging and data storage. You are free to
change these to suit your own environment and adjust the path names
used here accordingly.

Now that we’re ready, let’s start it up!
#start up front
  * bin/cassandra -f

2) two nodes configuration:
node1:192.168.46.155
node2:192.168.46.179

[2hei.net conf]$ cat cassandra.yaml
cluster_name: ‘Test Cluster’
initial_token:
auto_bootstrap: false
hinted_handoff_enabled: true
max_hint_window_in_ms: 3600000 # one hour
hinted_handoff_throttle_delay_in_ms: 50
authenticator: org.apache.cassandra.auth.AllowAllAuthenticator
authority: org.apache.cassandra.auth.AllowAllAuthority
partitioner: org.apache.cassandra.dht.RandomPartitioner
data_file_directories:
    – /var/lib/cassandra/data
commitlog_directory: /var/lib/cassandra/commitlog
saved_caches_directory: /var/lib/cassandra/saved_caches
commitlog_rotation_threshold_in_mb: 128
commitlog_sync: periodic
commitlog_sync_period_in_ms: 10000
flush_largest_memtables_at: 0.75
reduce_cache_sizes_at: 0.85
reduce_cache_capacity_to: 0.6
seeds:
    – node2
concurrent_reads: 32
concurrent_writes: 32
memtable_flush_queue_size: 4
sliced_buffer_size_in_kb: 64
storage_port: 7000
listen_address: 192.168.46.155
rpc_address: 0.0.0.0
rpc_port: 9160
rpc_keepalive: true
thrift_framed_transport_size_in_mb: 15
thrift_max_message_length_in_mb: 16
incremental_backups: false
snapshot_before_compaction: false
column_index_size_in_kb: 64
in_memory_compaction_limit_in_mb: 64
compaction_preheat_key_cache: true
rpc_timeout_in_ms: 10000
endpoint_snitch: org.apache.cassandra.locator.SimpleSnitch
dynamic_snitch: true
dynamic_snitch_update_interval_in_ms: 100
dynamic_snitch_reset_interval_in_ms: 600000
dynamic_snitch_badness_threshold: 0.0
request_scheduler: org.apache.cassandra.scheduler.NoScheduler
index_interval: 128

the same as node2,just need change
seeds:
    – node1

cat /etc/hosts    
192.168.46.155  node1
192.168.46.179  node2

Logs
#node1:
 INFO 10:23:46,151 Listening for thrift clients…
 INFO 10:23:46,315 Compacted to /var/lib/cassandra/data/system/LocationInfo-tmp-f-33-Data.db.  942 to 536 (~56% of original) bytes for 4 keys.  Time: 178ms.
 INFO 10:23:52,089 Node /192.168.46.179 has restarted, now UP again
 INFO 10:23:52,095 Node /192.168.46.179 state jump to normal
 INFO 10:24:02,177 Deleted /var/lib/cassandra/data/system/LocationInfo-f-32
 INFO 10:24:02,179 Deleted /var/lib/cassandra/data/system/LocationInfo-f-31
 INFO 10:24:52,097 Started hinted handoff for endpoint /192.168.46.179
 INFO 10:24:52,100 Finished hinted handoff of 0 rows to endpoint /192.168.46.179  
#node2:
 INFO 10:23:51,930 Binding thrift service to /0.0.0.0:9160
 INFO 10:23:51,939 Using TFastFramedTransport with a max frame size of 15728640 bytes.
 INFO 10:23:51,988 Listening for thrift clients…
 INFO 10:23:52,133 Node /192.168.46.155 has restarted, now UP again
 INFO 10:23:52,137 Node /192.168.46.155 state jump to normal
 INFO 10:23:53,548 InetAddress /192.168.46.155 is now dead.
 INFO 10:23:53,646 InetAddress /192.168.46.155 is now UP
 INFO 10:24:33,362 Started hinted handoff for endpoint /192.168.46.155
 INFO 10:24:33,365 Finished hinted handoff of 0 rows to endpoint /192.168.46.155
 
3) use cassandra:
#check cluster:
[2hei.net apache-cassandra-0.7.6-2]$ bin/nodetool -host localhost ring
Address         Status State   Load            Owns    Token                                      
                                                       168969914150282478893277211064871807700    
192.168.46.155   Up     Normal  53.28 KB        42.38%  70927753273796620281025030712152398970     
192.168.46.179   Up     Normal  45.16 KB        57.62%  168969914150282478893277211064871807700

#use cassandra-cli:
[2hei.net apache-cassandra-0.7.6-2]$bin/cassandra-cli –host localhost
[default@unknown] create keyspace FisherKeyspace;
2b1e86b8-ac65-11e0-9677-2edcd0f45bc6
Waiting for schema agreement…
… schemas agree across the cluster
[default@unknown] use FisherKeyspace;
Authenticated to keyspace: FisherKeyspace
[default@FisherKeyspace] create column family 2hei with comparator=UTF8Type and default_validation_class=UTF8Type;
3a0e8809-ac65-11e0-9677-2edcd0f45bc6
Waiting for schema agreement…
… schemas agree across the cluster
[default@FisherKeyspace] set Users[2hei][first] = ‘Fisher’;
Users not found in current keyspace.
[default@FisherKeyspace] set 2hei[2hei][first] = ‘Fisher’;
Value inserted.
[default@FisherKeyspace]  set 2hei[2hei][last] = ‘fishman’;
Value inserted.
[default@FisherKeyspace] set 2hei[2hei][age] = long(42);
Value inserted.
[default@FisherKeyspace] get 2hei[2hei];
=> (column=age, value=42, timestamp=1310461245929000)
=> (column=first, value=Fisher, timestamp=1310461237981000)
=> (column=last, value=fishman, timestamp=1310461242014000)
Returned 3 results.

[default@unknown] show keyspaces;
Keyspace: FisherKeyspace:
  Replication Strategy: org.apache.cassandra.locator.SimpleStrategy
    Replication Factor: 1
  Column Families:
    ColumnFamily: 2hei
      default_validation_class: org.apache.cassandra.db.marshal.UTF8Type
      Columns sorted by: org.apache.cassandra.db.marshal.UTF8Type
      Row cache size / save period in seconds: 0.0/0
      Key cache size / save period in seconds: 200000.0/14400
      Memtable thresholds: 0.0234375/5/1440 (millions of ops/minutes/MB)
      GC grace seconds: 864000
      Compaction min/max thresholds: 4/32
      Read repair chance: 1.0
   &nbsp
;  Built indexes: []

#other useful command of nodetool
bin/nodetool -host localhost ring
bin/nodetool -host localhost info
[2hei.net apache-cassandra-0.7.6-2]$ bin/nodetool -host localhost info
70927753273796620281025030712152398970
Gossip active    : true
Load             : 57.4 KB
Generation No    : 1310523824
Uptime (seconds) : 645
Heap Memory (MB) : 25.27 / 183.31
[2hei.net apache-cassandra-0.7.6-2]$ bin/nodetool -host localhost cfstats
Keyspace: FisherKeyspace
    Read Count: 0
    Read Latency: NaN ms.
    Write Count: 0
    Write Latency: NaN ms.
    Pending Tasks: 0
        Column Family: 2hei
        SSTable count: 0
        Space used (live): 0
        Space used (total): 0
        Memtable Columns Count: 0
        Memtable Data Size: 0
        Memtable Switch Count: 0
        Read Count: 0
        Read Latency: NaN ms.
        Write Count: 0
        Write Latency: NaN ms.
        Pending Tasks: 0
        Key cache capacity: 200000
        Key cache size: 0
        Key cache hit rate: NaN
        Row cache: disabled
        Compacted row minimum size: 0
        Compacted row maximum size: 0
        Compacted row mean size: 0

——————————–
接下来会继续完善cassandra的应用及api。

 

分类: OpenSource 标签:

Smartctl: Device Read Identity Failed

2011年7月6日 评论已被关闭

/usr/sbin/smartctl –all /dev/sda -d ata
smartctl version 5.38 [x86_64-redhat-linux-gnu] Copyright (C) 2002-8 Bruce Allen
Home page is http://smartmontools.sourceforge.net/
Smartctl: Device Read Identity Failed (not an ATA/ATAPI device)

A mandatory SMART command failed: exiting. To continue, add one or more ‘-T permissive’ options.

#my ENV:
[2hei.net ~]$ uname -a
Linux 2.6.18-194.26.1.el5 #1 SMP Tue Nov 9 12:54:20 EST 2010 x86_64 x86_64 x86_64 GNU/Linux
[2hei.net ~]$ cat /etc/redhat-release
CentOS release 5.5 (Final)
[2hei.net ~]# rpm -qa|grep smart
smartmontools-5.38-2.el5
[2hei.net ~]# rpm -qf /usr/sbin/smartctl
smartmontools-5.38-2.el5

Looks Sata discs are not accessed via the ‘-d ata’ option
#smartctl –help
  -d TYPE, –device=TYPE
         Specify device type to one of: ata, scsi, marvell, sat, 3ware,N

#get rid of -d ata        
[2hei.net ~]# /usr/sbin/smartctl –all /dev/sda
smartctl version 5.38 [x86_64-redhat-linux-gnu] Copyright (C) 2002-8 Bruce Allen
Home page is http://smartmontools.sourceforge.net/

=== START OF INFORMATION SECTION ===
Device Model:     WDC WD1002FBYS-02A6B0
Serial Number:    WD-WMATV6555969
Firmware Version: 03.00C06
User Capacity:    1,000,204,886,016 bytes
Device is:        Not in smartctl database [for details use: -P showall]
ATA Version is:   8
ATA Standard is:  Exact ATA specification draft version not indicated
Local Time is:    Wed Jul  6 03:32:03 2011 UTC
SMART support is: Available – device has SMART capability.
SMART support is: Enabled

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

General SMART Values:
Offline data collection status:  (0x84)    Offline data collection activity
                    was suspended by an interrupting command from host.
                    Auto Offline Data Collection: Enabled.
Self-test execution status:      (   0)    The previous self-test routine completed
                    without error or no self-test has ever
                    been run.
Total time to complete Offline
data collection:          (18600) seconds.
Offline data collection
capabilities:              (0x7b) SMART execute Offline immediate.
                    Auto Offline data collection on/off support.
                    Suspend Offline collection upon new
                    command.
                    Offline surface scan supported.
                    Self-test supported.
                    Conveyance Self-test supported.
                    Selective Self-test supported.
SMART capabilities:            (0x0003)    Saves SMART data before entering
                    power-saving mode.
                    Supports SMART auto save timer.
Error logging capability:        (0x01)    Error logging supported.
                    General Purpose Logging supported.
Short self-test routine
recommended polling time:      (   2) minutes.
Extended self-test routine
recommended polling time:      ( 214) minutes.
Conveyance self-test routine
recommended polling time:      (   5) minutes.
SCT capabilities:            (0x303f)    SCT Status supported.
                    SCT Feature Control supported.
                    SCT Data Table supported.

SMART Attributes Data Structure revision number: 16
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  1 Raw_Read_Error_Rate     0x002f   200   200   051    Pre-fail  Always       –       0
  3 Spin_Up_Time            0x0027   253   253   021    Pre-fail  Always       –       1100
  4 Start_Stop_Count        0x0032   100   100   000    Old_age   Always       –       28
  5 Reallocated_Sector_Ct   0x0033   200   200   140    Pre-fail  Always       –       0
  7 Seek_Error_Rate         0x002e   200   200   000    Old_age   Always       –       0
  9 Power_On_Hours          0x0032   089   089   000    Old_age   Always       –       8195
 10 Spin_Retry_Count        0x0032   100   253   000    Old_age   Always       –       0
 11 Calibration_Retry_Count 0x0032   100   253   000    Old_age   Always       –       0
 12 Power_Cycle_Count       0x0032   100   100   000    Old_age   Always       –       26
192 Power-Off_Retract_Count 0x0032   200   200   000    Old_age   Always       –       25
193 Load_Cycle_Count        0x0032   200   200   000 &n
bsp;  Old_age   Always       –       2
194 Temperature_Celsius     0x0022   116   112   000    Old_age   Always       –       34
196 Reallocated_Event_Count 0x0032   200   200   000    Old_age   Always       –       0
197 Current_Pending_Sector  0x0032   200   200   000    Old_age   Always       –       0
198 Offline_Uncorrectable   0x0030   200   200   000    Old_age   Offline      –       0
199 UDMA_CRC_Error_Count    0x0032   200   200   000    Old_age   Always       –       0
200 Multi_Zone_Error_Rate   0x0008   200   200   000    Old_age   Offline      –       0

SMART Error Log Version: 1
No Errors Logged

SMART Self-test log structure revision number 1
Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
# 1  Extended offline    Completed without error       00%      8195         –
# 2  Short offline       Completed without error       00%      8189         –

SMART Selective self-test log data structure revision number 1
 SPAN  MIN_LBA  MAX_LBA  CURRENT_TEST_STATUS
    1        0        0  Not_testing
    2        0        0  Not_testing
    3        0        0  Not_testing
    4        0        0  Not_testing
    5        0        0  Not_testing
Selective self-test flags (0x0):
  After scanning selected spans, do NOT read-scan remainder of disk.
If Selective self-test is pending on power-up, resume after 0 minute delay.

also some said libata patch is needed!

分类: linux 标签: