  Let $\mathscr{H}^2$ denote the Hardy space of Dirichlet series $f(s) =
\sum_{n\geq1} a_n n^{-s}$ with square summable coefficients and suppose that
$\varphi$ is a symbol generating a composition operator on $\mathscr{H}^2$ by
$\mathscr{C}_\varphi(f) = f \circ \varphi$. Let $\zeta$ denote the Riemann zeta
function and $\alpha_0=1.48\ldots$ the unique positive solution of the equation
$\alpha\zeta(1+\alpha)=2$. We obtain sharp upper bounds for the norm of
$\mathscr{C}_\varphi$ on $\mathscr{H}^2$ when
$0<\operatorname{Re}\varphi(+\infty)-1/2 \leq \alpha_0$, by relating such sharp
upper bounds to the best constant in a family of discrete Hilbert-type
inequalities.
