2006年四月月 发布的文章

'祸'不单行

俗话说:’福禄双至,祸不单行’,今天我终于体会到后者了。和以往一样早上起床还不算太晚,洗漱完毕,匆匆收拾物品,这时发现外面还在下着小雨而且风有3-4级,不知道今年是咋搞的,沈城的天气糟糕透顶,已经好久没有体会到艳阳天的感觉了。

顶风冒雨到食堂买好了早餐,又疾步冲到公司,冷风把手冻得那是相当的凉。到公司第一个要做的工作就是开机,我用的是自己的本本,公司配的台式机虽然性能超群,但是自己已经看不惯CRT显示器了。等我打开笔记本包才发现我的电源线没有带,我每天晚上用完本子后只是把本子放到包包中,因为我怕有小强之类的生命体寄生在我的本本中,对于电源线我只是拔掉后放在桌子上,第二天早上再装包,这下得到’报应’了,估计我的电源线不满了。心里一想,反正自己还有台式机呢,中午再回去取电源线也不迟,而且上午还有一个项目总结会,用电脑的时间应该不是很长。我就顺手按下了台式机的电源,可是等了半天,那个CRT显示器也不亮,我又重启了两次电脑,插拔几次电源线后,发现问题依旧,这时才意思到问题严重了,我这台式机可是一个月之前刚刚换的HP品牌机,怎么这才几天就不行了呢,况且这期间我使用它的次数屈指可数。HP呀让我怎么才能相信你的质量呢?真是’祸’不单行呀。没办法了,报修,然后冒雨回去取电源线,总不能不干活儿吧,遂打开伞,消失在风雨中^_^。

设备修理的同事效率还很高,等我取回电源线后,发现显示器已经’起死回生’了,问旁边的同事到底是如何弄好的?同事笑着回答说:"电源线接触不严",我自己插电源线的时候可是使了很大劲儿的哟,怎么还能接触不严,心想以后自己买电脑坚决不买HP的,HP的服务也许是金牌的,但是质量这么差,服务再好又能怎样。严重气愤,害得我在寒风中白跑那么远!

口语学习笔记之'享受闲暇时间'

继续学习’口语8000句’之’享受余暇时间’,下面是听写笔记!

[邀请友人]
Are you free this weekend?
Could I see you again?
Could you give me your phone number?
Where shall we meet?
Shall I come to pick you up?
Are you doing anything this afternoon?
How about having dinner with me?
Why don’t we go to see a baseball game?
Sorry, I’m tied up.
I’m afraid I can’t.
Thanks for asking, but…
How about a rain check?
I hope you can come.

[订计划]
When is it convenient for you?
About what time?
Whenever.
When you have time.
I’m free today.
I’ll be busy tomorrow.
How about the tenth?
When are you free?
That is a bad day for me.
That day is fine.
When can I come over?
You decide when/where.
Is seven convenient for you?
When can you come over?
Is it too early/late?
It is a date.
See you then.

[出门的时候]
Are you ready?
Ready!
I’m not ready.
What time shall we leave?
What time do we arrive?
Let’s get going.

[看电影]
Would you like to go to a movie?
What is on tonight?
What movie do you want to see?
I want to see…
Where is … playing?
How long is … playing?
Who is in this movie?
How long does it last?
What time is the next showing?
What time will it be over?
Two, please!
I can’t see because of the person in front of me.
We are way in the back, aren’t we?
Let’s sit closer up front.
That was interesting/boring, wasn’t it?
I was moved.

[听音乐会]
I like two tickets for October 3rd, please.
Sorry, we were sold out.
When do you have tickets?
What time does it start?
Can I make a reservation?
Where can I buy a ticket?
Is this seat taken?
We have great seats, don’t we?
Go for it!

[打高尔夫球]
I’d like to play golf.
Would you like to golf tomorrow?
Do you want to join me?
Are there any golf courses around here?
How much is it per person?
How much is it per day?
Are there any extra charge?
Can I rent the equipment?
Please make a reservation for golf.
I’d like to make golf reservation.
When would you like to play?
This Friday is possible.
There are four of us.
What time are we starting?

[一起去喝酒]
How about a drink?
I need a drink.
Would you like to have a drink after work?
Do you have any beer?
Two bottles of beer, please.
One whiskey with water, please.
What kind of snacks should we have?
Let’s forget about work and have some fun.
Cheers!
What are you drinking?
I like to go barhopping.
The first shape is the best.
Nothing beats this!
Would you like a refill?
Another beer, please.
This whiskey is strong.
How do you like sake?
It is strong.
I am drunk.
I feel a little tipsy.
I’m loaded.
Drink moderately!
I get drunk easily.
I drank too much.
I should have drank less. == I have drank too much.
I have a hangover.

[唱卡拉OK]
Let’s go to karaoke.
What is karaoke?
Singing along with recorded music.
Are you good at singing?
I’d like to request a song.
You sing first.
Let’s enjoy ourselves.
How about a song, John?
What are you going to sing?
Let’s sing a duet.
Now it is my turn.
I don’t have the nerve to sing in front of people.
I can’t keep up with the new songs.
I am tone-deaf.
What is your karaoke specialty?
I’ve never heard of that song.
You are a good singer.

[New Words To Me]
rain check — a promise that an unaccepted offer will be renewed in the future. (如果以后方便的时间或者下次还有机会,邀请继续有效)
get going — 出发
barhop — to patronize a series of bars during an evening.
refill — to fill again.
sake — a Japanese alcoholic beverage, brewed from rice. pronounced "SAH-KEH" in Japanese, but often "SAH-ki" by English speakers.
tipsy — slightly intoxicated.
loaded — very drunk.
duet — a composition for two voices or instruments.
tone-deaf — unable to appreciate music.

遇到系统的高可用性问题

我也是直到最近才接触到'高可用性'这个词儿的,从我所在的项目需求角度出发,我理解'高可用性'就是在系统的外部依赖实体(如主数据库、主网络)等瘫痪了之后,系统仍然能正常的支撑业务的运行,当然系统自己宕掉了,那就没辙了^_^。高可用性设计实际上就是在系统自身完好的情况下如何考虑其外部实体的设计以保证系统能持续的运行支撑下去,起码从我现在正在做的项目的角度来说是可以这样理解的。

目前我们的系统的高可用性主要体现在对数据库的访问机制上。对于24×7小时运行的系统来说,数据库不可避免的需要采用一些容灾机制来保证数据的正确和不丢失或者是将损失减少到最低点。我们的系统采用双机热备的方式,一旦ACTIVE数据库宕掉,我们的系统就应该'自动'切换到STANDBY数据库上。这里就存在一个问题,到底如何切换,又如何在ACTIVE数据库恢复后,重新将数据库切换回到ACTIVE数据库呢?我个人从一开始就想这个切换过程应该对我们的系统保持透明,我们的系统能看到的只有一套用户名、密码和服务名并利用这套配置访问数据库,置于访问到哪一个数据库可由数据库那方来定,这样对于我们的系统来说实现起来会简单很多,但是我们的技术支持组给的答案却是做不到,需要我们的系统自己提供一套行之有效的数据库切换方案。经过研究我们提供这样一套办法:利用一个外部监视程序定时检测主数据库是否可用,这个状态检测程序一旦发现主数据库不可用,就通过一个简单内部通信协议发送一个消息包到我们的系统,我们的系统解析该消息包,做出相应的切换处理,并发送告警通知相关人员;当检测程序一旦发现主数据库可用了,发送另外一个消息包通知我们的系统数据库恢复了。我们的系统中有多个兄弟进程依赖数据库,每个进程都是单独与数据库建立session的,这样一旦需要切换数据库,我们这些可怜的进程就需要做同样的判断流程,可想而知代码中会存在多少的重复或相似的代码段,而且一旦流程修改我势必要修改多处,这样代码中的坏味道儿可就太浓了,势必应该进行重构,记得以前写过这么一篇'C语言也重构',关于C语言重构的一些事项可以到那篇文章中查询。

灵光一闪!突然想到在Java组有数据库连接池的概念,我们可否效仿一下呢,我们也做一个这样的'数据库Session池'或者是一组抽象了的数据库session管理接口,这样对session的管理就集中起来了!session的管理接口负责判断是否需要切换和重新连接数据库,而这些切换操作对那些依赖数据库的进程来说是透明的。这样每个进程在每处理一条消息的时候都去调用一次open_session这样的接口,然后利用打开的session进行数据库操作即可。而open_session这个接口的实现也许要分两种情况:
1、在未切换数据库的情况下,使用原来已经存在的session即可,这里浪费的仅仅是一次条件判断而已;
2、在切换数据库的情况下,重新建立一个连到新数据库的session即可。

感觉这个方案可行,晚些儿时候再认真考虑一下,拿出一套可行方案。其实这里还要考虑这样一种情况也是可能性极其微小的情况,那就是两个数据库都宕了,这时候要考虑高可用性的话,那就该提供一些在没有数据库情况下的默认处理机制或者策略了。

欢迎使用邮件订阅我的博客

输入邮箱订阅本站,只要有新文章发布,就会第一时间发送邮件通知你哦!




这里是Tony Bai的个人Blog,欢迎访问、订阅和留言!订阅Feed请点击上面图片

如果您觉得这里的文章对您有帮助,请扫描上方二维码进行捐赠,加油后的Tony Bai将会为您呈现更多精彩的文章,谢谢!

如果您希望通过微信捐赠,请用微信客户端扫描下方赞赏码:


如果您希望通过比特币或以太币捐赠,可以扫描下方二维码:

比特币:


以太币:


如果您喜欢通过微信App浏览本站内容,可以扫描下方二维码,订阅本站官方微信订阅号“iamtonybai”;点击二维码,可直达本人官方微博主页^_^:



本站Powered by Digital Ocean VPS。

选择Digital Ocean VPS主机,即可获得10美元现金充值,可免费使用两个月哟!

著名主机提供商Linode 10$优惠码:linode10,在这里注册即可免费获得。

阿里云推荐码:1WFZ0V立享9折!

View Tony Bai's profile on LinkedIn


文章

评论

  • 正在加载...

分类

标签

归档











更多