Is it necessary to know a lot of advance math to become a good junior high/high school teacher?

By "advance math" I refer to Real Analysis, Abstract Algebra and Linear Algebra (to the level of Axler). I received mainly Bs in these courses with the exception of the intro-level Linear Algebra. Since I intend to be a teacher, is it necessary to have mastered these subjects at the elementary level?

-
It can't hurt. If you end up having a really bright student, you can help point him to more interesting material. –  Qiaochu Yuan Mar 2 '13 at 7:38
It's probably a good idea to at least have a thorough mastery of all mathematics at the first to second year undergraduate level. It is not uncommon for bright high school students to be at such levels. –  EuYu Mar 2 '13 at 7:57

For high school, of course it must be clear that you have to know elementary algebra, probability and statistics, and calculus very well. Some high schools also have courses in linear algebra.

It will help you to teach these subjects if you are able to explain their underlying motivation, however, and you build your ability to do this by studying their advanced counterparts. It's difficult to make integrals interesting when you've never done any PDE, never done any analysis in $\mathbb{R}^n$. Most importantly, studying advanced material teaches you how to think like a mathematician, which is exactly what high school students need (but rarely get the chance) to see.

You can teach calculus classes out of a textbook, but you won't be a good teacher. Take pride in your work - be engaging and inspiring, not another lame high school teacher that bores kids to death and turns them off from math for life. Take advanced coursework now, while you're still in school.

-
" think like a mathematician, which is exactly what high school students need (but rarely get the chance) to see." +1 –  user7530 Oct 19 '13 at 14:06

"Is it necessary to know a lot of advanced math to become a good junior high/high school teacher?"

It is neither necessary nor sufficient.

One of the best math teachers I've ever had probably doesn't remember much (if any) advanced math beyond linear algebra. I don't know how he performed as a math student himself, but I'm not sure it really matters. He is almost universally loved by his students, is very involved in the math team, and consistently challenges students to go beyond the routine algorithms and formulas. (For context, by the way, he teaches at Stuyvesant High School, a mathematical powerhouse.)

On the flip side, I've also had teachers who certainly knew advanced math very well, but were unable to communicate effectively even the basics to students. I won't belabor this point.

Of course, as Qiaochu points out, having an understanding of advanced math certainly couldn't hurt. For example, it might help provide a deeper context for some of the math you're teaching.

Now I'm not yet a teacher myself, so maybe you should take what I'm saying with a grain of salt. But as far as I can tell:

At the end of the day, good teaching is about dedication, effective communication, a responsiveness to student needs, and an interest in mathematics that goes beyond the textbook. These are the important things.

-