遇到系统的高可用性问题

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

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

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

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

口语学习笔记之'在家中'

我是悟出来了:要想学好英语,特别是要想学好口语,必须要通过背诵这一关,特别是在没有语言环境的条件下,’死记硬背’不失为一好办法。而俗话说的好:’好记性不如烂笔头’,下面就是我听’口语8000句’的第一课’在家中’的听写笔记。

[从起床到出门]
Good Morning!
Did the alarm clock go off?
It is time to get up!
Get up soon!
Are you awake?
Are you feeling sick?
Did you sleep well?
Would you turn off the alarm clock?
You finally got up.
It is a nice day!
Did you stay up late last night?
Let us fold up the futon/pillow.
You were snoring last night.
I had a nightmare.
You left the light on.
I have to go (and) wash my face.
It is time to have breakfast.
I am still sleepy.
I am still yawning.
I have a hangover.
I am a night person.
Coffee wakes me up.
Did you brush your teeth?
I have to comb my hair.
What should I wear?
Hurry up and get dressed.
Put those pajamas away.
I am leaving. Bye Mom!
Let’s play hooky today!
You are wearing your sweater inside out.
It is upside down.
Don’t forget to take out the garbage.
It is your turn to take out the garbage.
What are you doing today?
If you don’t hurry, we will be late.
Hurry up or you’ll be late for school.
Did you lock the door?
Are you forgetting something?
It is already 8:00 clock!
I am late.
I have to rush!
Are you gonna be late today?
What time are you coming home?
Have you got your lunch box?
It might rain today.
Don’t forget to lock the door when you leave.

[从回家到就寝]
I’m home/back.
Welcome home/back.
Did you have a goog time?
How did it go today?
Can I go out to play?
I’m hungry.
Where are the snacks?
I am going to cram school now.
May I have my allowance?
I am tired.
What would you like for dinner?
Would you help me set the table?
What should I make for dinner?
It is good to be home.
Would you run to the store?
The bath is ready.
I am taking a shower.
Is dinner ready?
Mom, what is for dinner tonight?
What is for dinner?
Today we are having curry.
How soon can you get it ready?
Let’s eat.
Please go ahead.
The knife cuts well, doesn’t it?
The water is boiling.
Come and get it!
It is time to eat.
I’m coming.
Did you wash your hands well?
Don’t spill it.
Eat all of your vegetables.
Finish up your plate.
I don’t like asparagus.
It was very delicious, Thank you.
Would you clear the table?
Do the dishes!
I will dry the dishes.
What are you doing?
I am watching TV.
Are there good programs on TV?
What is on channel 8?
Would you change the channel?
I want to watch more TV.
Let us spread out the futon.
I am sleepy.
Did you do your homework?
Study hard!
Hurry up and go to sleep.
Enough with your video game.
Make sure you brush your teeth.
Are you ready for tomorrow?
I am going to take a bath.
Time to go to sleep.
You left the TV on.
Don’t leave your stuff here.
I set the alarm clock for 8:00.
Wake me up at 7:00 tomorrow.
Good night!
Sweet dreams!

[休息日]
I want to take a nap.
I am going to lie down.
You are pretending to be asleep.
Were you sleeping?
No, I was awake.
Will you change the baby’s diaper?
Do you need to pee?
It is time to go wee-wee(pee-pee).
Peekaboo!
Let us play catch!
The water is leaking.
It is so dusty.
It is stuffy in this room.
It is drafty in this room.
Wiil you feed the dog?
Will you take the dog for a walk?
Take care of my brother and sister.
Please water the plants.
What a mess!
Help me!
Clean up your room.
Help me clean up the house.
We’re out of the dish detergent.
Would you put up the clothes to dry?
Will you help me fold up the clothes?
Please scrub the sink.
I have to vacuum my room.
Please dust the shelves.
Please mop the floor.
Will you iron the shirt?
I have to iron my skirt.
Let us go grocery shopping.
The park was crowded.
Can you baby-sit tonight?

[送礼物]
This is for you.
This is your share.
What do you want for your birthday?
Ta-dah!

[生活习惯]
I usually work out after work.
I started jogging.
I quit smoking.
Do you dream often?
I’ve been forgetful lately.

[理财]
When is this due?
It is due on the thirtieth.
Could you give me change?
Do you have change for 100 yuan?
I need to withdraw 1000 yuan from my saving account.
I paid out of my own pocket.
I am out of cash.
I don’t have much money on me now.
I am broke.
I have a lot of money on me now.
I can not afford to be lazy.(没时间闲呆着)
What a waste!
He didn’t pay the debt and disappeared.

[New Words To Me]
futon — a simple Japanese floor bed or mattress made from strong cotton fabric and filled with cotton waste, tufted and unbordered.
snore — breathe noisily during one’s sleep.
yawn — an involuntary intake of breath through a wide open mouth; usually triggered by fatigue or boredom.
hangover — medically termed veisalgia, is the after-effect following the consumption of large amounts of one drug or another. In particular, it is most commonly associated with the consumption of alcoholic beverages.
comb — a thin toothed strip, as of plastic, used to smooth, arrange, or fasten the hair.
pajamas — a form of nightwear for those who do not prefer to sleep in their underwear or nude.
play hooky — (slang.) play truant from work or school.
snack — a hurried or light meal; Food eaten between meals.
cram school — schools that train their students to meet particular goals, most commonly to pass the entrance examinations of high schools or universities.
allowance — a term used to describe a regular allocation of money from one person to another. Usually parents will give their children a relatively small amount of money on a recurring basis.
curry — season with a mixture of spices; typical of Indian cooking.
spill — to cause or allow (a substance) to run or fall out of a container.
asparagus — 芦笋
spread out — unfold; open from a closed or folded state.
stuff — household or personal articles considered as a group.
nap — to sleep for a brief period, often during the day; doze.
diaper — a folded piece of absorbent material, such as paper or cloth, that is placed between a baby’s legs and fastened at the waist to contain excretions.
pee — (slang.) informal terms for urination.
wee-wee — as same as pee.
peekaboo — a game for amusing a small child, in which one covers one’s face or hides and then returns to view saying Peekaboo!
stuffy — lacking sufficient ventilation; close.
drafty — having or exposed to drafts of air.
detergent — a cleansing substance that acts similarly to soap but is made from chemical compounds rather than fats and lye.
scrub — to remove (dirt or stains) by hard rubbing.
sink — a water basin fixed to a wall or floor and having a drainpipe and generally a piped supply of water.
vacuum — a device that uses suction to collect dirt from the bottom and sides of a pool.
dust — to remove dust from by wiping, brushing, or beating.
mop — to wash or wipe with or as if with a mop.
grocery — a store selling foodstuffs and various household supplies.
jog — to run or ride at a steady slow trot.

如发现本站页面被黑,比如:挂载广告、挖矿等恶意代码,请朋友们及时联系我。十分感谢! Go语言第一课 Go语言精进之路1 Go语言精进之路2 Go语言编程指南
商务合作请联系bigwhite.cn AT aliyun.com

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

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

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

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

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

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

比特币:

以太币:

如果您喜欢通过微信浏览本站内容,可以扫描下方二维码,订阅本站官方微信订阅号“iamtonybai”;点击二维码,可直达本人官方微博主页^_^:
本站Powered by Digital Ocean VPS。
选择Digital Ocean VPS主机,即可获得10美元现金充值,可 免费使用两个月哟! 著名主机提供商Linode 10$优惠码:linode10,在 这里注册即可免费获 得。阿里云推荐码: 1WFZ0V立享9折!


View Tony Bai's profile on LinkedIn
DigitalOcean Referral Badge

文章

评论

  • 正在加载...

分类

标签

归档



View My Stats